1, Classpath is to save the location of the. class file, provide the first place to run the Java command, if "." is added, the query will be prioritized in the current directory; "." Put it in the back
Prioritized query settings for the directory. No ";", no longer other catalog input query;
2, the escape character \b does not seem to have any effect;
3, the binary conversion divided by 2, turn back to each by the current number of bits minus together, 110 0*2 (0) +1*2 (1) +1*2 (2) = 6;
4. Basic data type
Bytes Byte 8
Character Char 16
Short-integer 16
Integer int 32
Single-precision float float 32
Long Integer 64
Double-precision floating-point double 64
Boolean type Boolean 1 or 4
5. Negative numbers exist in the form of complement in the computer;
Take counter +1;
6, the size of the data type conversion refers to the size of the occupied memory space;
7, arithmetic expression, when the logical expression is calculated: All the values of byte, short, and Char will be promoted to the int type.
8. The bitwise operator is used to manipulate a single bit (bit) in the integer base data type, which is the binary, and the bitwise operator performs a Boolean operation on the corresponding bit in the two parameters, resulting in a result.
9, the displacement operator of the binary aspect of the operation;
10, the anonymous object does not have the corresponding name, is used as the actual parameter call method;
11, encapsulation is the use of private modifier variables, and then set the corresponding set and get method to pass the value and call the variables;
12, the construction method is used to assign values to the object's properties when the object is created;
13, constructs the code block function: gives all the object to unify the initialization.
14, switch temporarily does not support string type of variable!
15, Syso plus alt+/can be directly output System.out.println ();
16, a call a B function, the value of the variable passed in the B function will not change in the a function, because the address of the variable is not one, you want to use the B function to change the value, you can return the value, you can also pass in the array;
Lucky Number Draw:
Packageday01;ImportJava.util.Scanner; Public classEXERCISES5 {//Main interface Public Static voidMain (string[] args) {Boolean Judge=true; String [] User=NewString[3]; while(judge) {view1 ();//InterfaceScanner input=NewScanner (system.in); intselect=Input.nextint (); Select (Judge, user, select); }}//Select Public Static voidSelect (Boolean judge, string[] user,intSelect) { Switch(select) { Case1: System.out.println ("award-winning Millionaire system--registration"); Register (User,judge);//Register Break; Case2: System.out.println ("award-winning Millionaire System login"); Login (User,judge); //Login Break; Case3: System.out.println ("Prize-rich system--lottery"); Lucky (user, judge); Break; default: System.out.println ("Your input is wrong!" "); } }//Show Public Static voidView1 () { for(inti=0;i<6;i++) {System.out.print ("*"); } System.out.print ("Welcome to the award-winning monopoly system"); for(inti=0;i<6;i++) {System.out.print ("*"); } System.out.println (""); for(inti=0;i<9;i++) {System.out.print (" "); } System.out.println ("1 Registration"); for(inti=0;i<9;i++) {System.out.print (" "); } System.out.println ("2 Login"); for(inti=0;i<9;i++) {System.out.print (" "); } System.out.println ("3 Draw"); for(inti=0;i<27;i++) {System.out.print ("*"); } System.out.println (""); System.out.print ("Please select menu:");}//Continue module Public Static voidCountinue (Booleanjudge) {Boolean Judge2=true; while(judge2) {System.out.print ("Continue?" (y/n): "); Scanner Input2=NewScanner (system.in); String Command=Input2.next (); if("Y". Equals (command) {Judge2=false; } Else if("N". Equals (command) {Judge=false; Judge2=false; }}}//registering the module Public Static voidRegister (string[] user,Booleanjudge) {Scanner input=NewScanner (system.in); System.out.print ("Enter User name:"); user[0]=Input.next (); System.out.print ("Enter Password:"); user[1]=Input.next (); intId= (int) ((Math.random () *9+1) *1000); user[2]=integer.tostring (ID); System.out.println (user[2]); System.out.println ("Registration is successful!" Please remember your membership card number! "); System.out.println ("User name \ t password \ t card number"); System.out.println (user[0]+ "\ t" +user[1]+ "\ T" +user[2]+ "\ T"); Countinue (judge); //Continue module}//Login Module Public Static voidLogin (String[]user,Booleanjudge) { for(inti=0;i<3;i++) {Scanner input=NewScanner (system.in); System.out.print ("Please enter user name:"); String username1=Input.next (); System.out.print ("Please enter your password:"); String Password1=Input.next (); System.out.print ("Please enter your membership card number:"); String ID1=Input.next (); if(User[0].equals (username1) &&user[1].equals (password1) &&user[2].equals (ID1)) {System.out.println ("Successful Landing!" "); I=i+3; Judge=true; } Else{Judge=false; }} countinue (judge); //Continue module}//Lucky Draw Public Static voidLucky (string[] User,Booleanjudge) { intId1= (int) ((Math.random () *9+1) *1000); intId2= (int) ((Math.random () *9+1) *1000); intId3= (int) ((Math.random () *9+1) *1000); intId4= (int) ((Math.random () *9+1) *1000); intId5= (int) ((Math.random () *9+1) *1000); intNum=integer.parseint (user[2]); if(num==id1| | num==id2| | num==id3| | num==id4| | num==ID5) {System.out.println ("Successful Draw!" "); }Else{System.out.println ("Thank you for coming!" "); } countinue (judge); //Continue module}}
2017/12/24 Java Fundamentals