1. Large Bracket scope problem
Public Static void Main (string[] args) { { int x; { int x; // compilation error: Duplicate local variable x } }}
Operation of 2.boolean values
Public Static voidMain (string[] args) {if(true&&false) {} if(true&false) {} System.out.println (true&false); System.out.println (true^false); System.out.println (true|false);}
False
True
True
3.continue Label and Break label
Public Static voidMain (string[] args) {label: for(inti=0; i<2; ++i) {System.out.println ("I=" +i); for(intj=0; j<3; ++j) { if(J = = 1){ //continue; //Break ; //continue label; Breaklabel; } System.out.println ("J=" +j); } }}
In this example, continue label and break have the same effect.
Public Static voidMain (string[] args) {label: for(intI=r; k<2; ++k) {System.out.println ("K=" +k); for(inti=0; i<2; ++i) {System.out.println ("I=" +i); for(intj=0; j<3; ++j) { if(J = = 1){ //Break ; Continuelabel; } System.out.println ("J=" +j); } } }}
This example is more intuitive to see the continue label to achieve a different effect!
4. Function overloading of parameters for basic types and corresponding objects
classa{ Public voidFunintx) {System.out.println ("Int Overload"); } Public voidFun (Integer x) {System.out.println ("Integer Overload"); }} Public classmain{ Public Static voidMain (string[] args) {A a=NewA (); intx = 1; Integer IX= 1; A.fun (x); A.fun (ix); }}
int overload
Integer overload
Some of the details of Java attention