Java Review for ....

Source: Internet
Author: User

1. Identifiers

The object used to name the program, such as the method name, variable name, and the rule is:

A, case sensitive

b, made up of English characters, literal characters, dollar signs, underscores, and numbers, but cannot start with a number

C. cannot be a keyword

2,%: Find the remainder operator 23%-4 result is 3

3, ++i: Refer to the variable I first, then perform i+1 assignment to I as the result of the operation

i++: Execute I plus 1 First, then assign the result to I as the result of the operation reference

4, the name of the array of three

A, int intarray[]; Intarray=new Int[5];

b, int intarray[]=new int[5];

c, int [] intarray={1,2,3,4,5};

5, String for processing immutable string, Stringbuff for processing can change the string

Method of String:

A, take the substring of the string substring

    string substring (int startpoint) startpoint to start subscript to end of string

String substring (int startpoint,int endpoint) takes the start subscript as startpoint and ends with the subscript endpoint-1

B. Method of comparing equality as s1.equals (S2) standard: Boolean equals (String s)

C, S1.concat (s2) String connection

D, S1.startswith (S2) s1.endswith (s2) s1 and S2 prefix suffixes of the method of comparison: Boolean startsWith (String s)

E, length of String ()

F, int indexOf (string s) retrieves the position of the first occurrence of the string s from the head of the string

int indexOf (String S,int startpoint) retrieves the position of the string s again from the position of the string startpoint, if no return-1 is retrieved

G, front and back spaces: trim ()

H, ignore case: Boolean equalsignorecase (String s)

6, in the core of JAVAJDK, the parser corresponding executable file is: Java.exe

7. Basic data types

BYTE: Byte is 1 bytes, 8 bits

Short integer: 2 bytes, 16 bits

Integer: Int takes 4 bytes, 32 bits

Long integers: Long is 8 bytes, 64 bits

Single precision: Float takes 4 bytes, 32 bits

Double precision: Double is 8 bytes, 64 bits

8. There are 3 types of control statements in the Java language: Conditional statements (if, switch), loop statements (For,while,do ... while), transfer statements (break,continue)

9, the declaration of the array must use the new operator to allocate memory space

10, Java interface Default access rights are public

11. The difference between break and continue

Break: Forces the current loop to continue execution from the first statement outside the loop

Continue: End this cycle ahead of time, go straight to the next cycle to continue execution

12, applications and small applications but not

A Java application must have only one class containing the main method, which becomes the main class of the application

A Java applet applet does not require the main main class, but must have a class extension applet class, which is the main class of the applet

13. Method Overloading: A class can have multiple methods with the same name, but the parameters of the method must be different or the number of parameters is different or the type of the parameter is different

  Constructor Method: The method name is the same as the class name, and no result is returned and the Void keyword is not written; If a class does not have a constructor defined, the system will add a constructor without parameters by default.

14, how to define the interface and use the interface in Java?

Defining an interface using the keyword interface

A class declares itself to use one or more interfaces through the keyword implements, if multiple interfaces are used, separated by commas, and if a class uses an interface, the class must implement all the methods of that interface.

15. Briefly describe the use of this in Java

A. Call construction method with this

b, when referencing the current object of the class to which the function belongs in a function, use this

C, call member variable, this. Member variable (in case of a function parameter or a local variable in a function or member variable with the same name, the member variable is masked in the north, at which point the member variable needs to be called with this)

 

16, StringTokenizer Class

StringTokenizer (String s,string delim) constructs a parser with the string s, with the character in the string argument Delim as the delimiter, and does not define a space by default

 

Java Review for ....

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.