Learn to program the Java Learning Tutorial code block published, welcome to visit through the xuebiancheng8.com
The code blocks in Java include the following:
1. Common code Blocks
2. Building code Blocks
3. Static code block
1. Common code block is very simple to see the following example:
public class test{
public static void Main (String args[]) {
{//This is a normal block of code, and the code in the normal code block executes sequentially
System.out.println ("Hello");
}
}
}
2. Building code Blocks
public class test{
{
System.out.println ("Here is the construction code block, executed before executing the construction method");
}
public static void Main (String args[]) {
}
}
3. Static code block
public class test{
static{
System.out.println ("Here is a static block of code that executes when the test class is called, first constructs a block of code and constructs a method of execution");
}
}
The above is a few blocks of code in Java, more information can be accessed through xuebiancheng8.com
The specific URL is
Http://xuebiancheng8.com/play/goodgoodstudy_133_daydayup.html
Java Learning Tutorial code block