Overview
Company business needs, products must have. NET and need Java, have no choice, only spare time to learn Java, the overall feel Java also. NET is very similar, but the syntax is different, the difference is not very big, this will learn the basic knowledge of Java to organize, so that their own learning. As a. NET program apes can also learn Java, after all, the technology is more than the body, learning to be proficient.
Development tools
Eclipse, developing Java-like. NET needs to install a JDK similar to the. NET Framework.
Java Development tools Eclipse settings
1 , set font: window settings; 2, set shortcut key: window--3, Implement Interface: Alt+shint+s overried/Implement Mathod; Implements implement interface, add Package reference Import4, code adjustment: Ctrl + mouse click 5, autorun code shortcut: CTRL+F11 Debug Run: F11
Basic syntax
Modifier:
synchronized: Same variable, only one thread is allowed to access at the same time; volatile : The same variable, the same time allows multiple threads to access; transient: serial number, do not participate in serialized data; extends inherit the parent class;
Java operators:
The instanceof operator that represents whether the data instance conforms to the specified data type. (Object reference variable) instanceof (class/interface type)
Cycle:
foreach for (Declaration statement: expression) {// code sentence }
Java Number class:
int As with integer, int is the built-in type, and integer is the class of int. parseint () resolves the string to the int type. ValueOf () returns the built-in data type specified by a number object
Java Character class:
The built-in data type char provides the wrapper class character class; toLowerCase () is a lowercase letter; toUpperCase () specifies the uppercase form of the letter;
String uses:
String.Format ("%f", "" "); // System.out.printf ("%d", ""); System.out.printf ("%TC", "" "); StringBuffer and Stringbuilder:stringbuffer thread-safe collection, StringBuilder operation data faster;
Numeric variable declaration:
Datatype[] Arrrefvar ==>>dataType arrrefvar[]arrays.sort (myList); // Sort Numbers Arrays.fill (MyList,ten); // Assign Value Arrays.binarysearch (MyList,5); // Find Arrays.tostring (myList); // conversion string;
Date Time:
Date Type: Date tv=NewDate; SimpleDateFormat formatted data types for time, Tf.format (MyTime) and Tf.parse ("2016-12-12"); SimpleDateFormat TF=NewSimpleDateFormat ("YYYY-MM-DD"); System.currenttimemillis ()//get current system timeCalendar Package type for date: Calendar Calend=calendar.getinstance ();//Initializing InstancesGregorianCalendar dat=NewGregorianCalendar ();//action classes on dates
Java Basics Finishing (i)