知识点:
1.Java类型分为基本类型和引用类型
2.静态成员不能访问非静态成员
3.Myeclipse 代码格式调整快捷键Ctrl+Shift+F
4.Java中只有值传递
public class Person { public String name; public static String sex; public int age; public static void say(String content) { System.out.println(content); } public static void main(String[] args) { Person p = new Person(); p.name = "java"; p.age = 22; p.sex = "男"; p.say("Hello World!"); Person.say("Hello World!"); Person.sex = "男"; System.out.println(p.name); System.out.println(p.age); Person.say(p.name); }}
运行截图