使用对象的步骤:
1.创建对象
语法:
类名 对象名=new 类名();
例子:
HelloWorld helloWorld=new HelloWorld();
2.使用对象:
1.引用对象的属性:
语法:
对象名.属性
例子:
helloWorld.weather="spring";//给字符串类型属性Weather赋值"spring"
2.引用对象的方法:
语法:
对象.方法名()
例子:
helloWorld.thunder();