Java Training Java49 Basics

Source: Internet
Author: User
Tags instance method

Java training This article is mainly to give you a refresher on some of the basic knowledge of Java, after all, the basic knowledge to grasp the firm, as the saying goes, the foundation must be mastered good!

1. member variables in Java are also divided into instance member variables and class member variables.

2, the purpose of writing class is to describe a class of things common properties and functions.

3, the type of member variables and local variables can be any one of the data types in Java.

4. The member variable described with the modifier static is a class variable.

5. If the name of the variable is the same as the name of the member variable, the member variable is hidden and the member variable is temporarily invalidated within the method.

6. The member variable described with the modifier static is a class variable.

7. If the name of the local variable is the same as the name of the member variable, the member variable is hidden.

8. The method definition consists of two parts: the method declaration and the method body.

9. In Java, the return type must be void when a method does not need to return data.

10, method overloading means that a class can have more than one method with the same name and type, but the parameters of these methods must be different.

11, in the Java programming language, it allows several methods in a class, all have the same name, this usage is called method overloading.

12. The constructor method is a special method whose name must be exactly the same as the name of the class in which it resides, and does not return any data types.

13. The methods of class in Java are divided into example methods and class methods.

14, because the content of the class body consists of the definition of the member variable and the definition of the member method, the operation of the member variable can only be placed in the member method.

15. The constructor method in Java is the same as the class name, there is no return value and is automatically called by the new operator when the object instance is created.

16. Only class variables and class methods can be called in class methods, and instance methods cannot be called.

17. The instance method can manipulate the instance variables as well as the class variables, and the class method can only manipulate the class variables.

18. Classes in Java are templates for creating objects.

19. When an object is created using a class, we also say that an instance of this class is given.

20. In Java, a class is used to create an object that includes the declaration of an object and two steps to allocate memory for the object.

21, the general format of the object declaration is the name of the class name object.

22. A class can create several different objects by using the new operator, which allocates different memory space.

23. A class allocates memory for declared objects by using the new operator and the constructor of the class.

24. After the object is created, by using the operator ".", the object can implement access to the variable and invoke the method.

25. Instance variables of different objects in Java will be allocated different memory spaces.

26. In Java, if a member variable in a class has a class variable, all of the objects are assigned to the same memory for such a variable.

27. The difference between a class method and an instance method is that the class method can be called not only by the object but also by the class name, but not by the instance method.

28, the class method method can be called by the object not only by the class name, but the instance method can not.

29, the method in the class body is divided into: instance method and class method.

30. The package statement, as the first statement of the Java source file, indicates the packet containing the class defined by the source file.

31, in the Java program, the system will automatically introduce Java.lang this package, so no need to use import statement to introduce the package.

32. In a Java program, in order for the program to be able to use a custom package, the location of the custom package must be indicated in the CLASSPATH environment variable.

33. The Java.lang package is the core class library of the Java language, which contains the necessary system classes for running Java programs.

34. In order to be able to use the classes provided by Java, we can use the statement import to introduce the required classes.

35. Member variables and methods in Java that are decorated with private are called private variables and private methods.

36. Member variables that are not decorated in Java are called friendly variables.

37, access rights are private variables, can only be used in this class, can not be used outside the class.

38. Member variables and methods in Java that are modified with public are called shared variables and common methods.

39, access rights are common variables, not only used in this class, but also in any other class to use.

40. Access rights are friendly variables that can only be used in this class and other classes in the same package as this one.

41. Inheritance is a mechanism for creating new classes from existing classes.

42. The class derived from inheritance in Java is called a subclass, and the inherited class is called the parent class.

43. Multiple inheritance is not supported in Java.

44. In the declaration of a class, create a subclass of a class by using the keyword extends.

45. A class in Java can have 1 parent classes.

46, if the declaration of a class does not use the extends keyword, this class is implicitly considered to be a subclass of the Object class.

47. Subclasses naturally inherit member variables that are not private in their parent class as their own member variables.

48. When the member variable defined in the subclass has the same name as a member variable in the parent class, the member variable of the subclass hides the member variable of the parent class.

49. Subclasses can change the state and behavior of a parent class to its own state and behavior by hiding the member variables and overriding the methods.


Java Training Java49 Basics

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.