The First Class
来源:互联网 发布:淘宝小白号 编辑:程序博客网 时间:2024/05/06 09:51
/** * FirstClass.java */
package mypackage;
import java.io.System;
public class FirstClass() {
public static void main(String[] args) {
printout();
}
public void printOut() {
System.out.println(str);
}
private String str = “Hello, World!”;
}
It is the first class writing in Java.
There can be only one public class in one source file and this class name must be the same with the file name.
The “public class FirstClass()” is to declare an class. It is the head of the class and the content in {} is the body of the class.
The “public static void main(String[] args)” is the main() method. It is the entrance of a programme. Only the programmes which have main() method can be executed. The definition of main() method is only this way. The main() method is not a behavior.
The “public void printOut()” is a method of the class and the “private String str” is a field of the class.
- The First Class
- The first class after reading the section7.1 <<C++ primer>>
- first class, first-class object
- 1.Hello World!——start from the first class.
- The First!
- The First
- the first
- The first
- The first!
- The first
- The first
- The First
- the first
- The First
- the first
- the First
- The First
- The First
- 近期生活
- 离别之痛(伟大的爸爸妈妈)
- 获取数据库查询结果
- (Struts重构)构建一个简单的基于MVC模式的JavaWeb
- 快乐中带着点点优郁
- The First Class
- 广东之行
- DES算法实现过程分析
- 总结SQL索引
- DES算法
- 什么是黑客?
- G-Force IPhone 想法记录
- Oracle PL/SQL的数据类型和常用函数
- CoreIMG,最有效的媒体解决方案