课程: Java Essential Training: Syntax and Structure
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Main method
- [Angie] Any code added between these two braces will belong to the Java class. The curly braces encompass a block of code. Inside of this class, we're going to create a method, which is another block of code. In order to run any code from within a Java class, It must be inside of a method. To create the method, we'll say public static void main. And we'll also add a set of curly braces here. The method we've added is called the main method, which is the entry point for running a program in Java. When we execute this class, it's going to first look for the main method within this class, and this is the starting point of the program. It has to be defined just like this. Methods also have this set of curly braces. So everything that exists between these curly braces will belong to this main method. Let's add a print statement inside of the main method just to see it execute. To print a line in Java, we use the command…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。