Grammatical important points of knowledge
- 8 Basic data types: Byte,short,int, long,double, Float,char,boolean (1,2,4,8,4,8,2byte).
- The meaning of an explicit identifier, keyword, variable, constant.
- Operators: Assignment operators, arithmetic operators, comparison operators, logical operators, bitwise operators, ternary operators (?). :)。
- Type conversions.
- Code comments.
Process Control key points of knowledge
- Conditional statement (if statement, switch statement (can use shape, character, string))
- Loop statement (While,for,foreach)
Practice:
- Print a diamond with a for loop
Public Static voidMain (string[] args)
{ for(inti=1;i<5;i++)//draw above 4 lines { for(intj=4;j>i;j--)//Draw Spaces{System.out.print (" "); } for(intk=1;k<=i*2-1;k++)//painting *{System.out.print ("*"); } System.out.println (); } for(inti=1;i<4;i++)//draw the following 3 lines { for(intj=i;j>0;j--)//Draw Spaces{System.out.print (" "); } for(intk=5;k>=i*2-1;k--)//painting *{System.out.print ("*"); } System.out.println (); } }
Java Learning--chapter II, "Java syntax"