~~~
package com;
public class Student {
String name;
int age;
String code;
String clazz;
void listen(String teacher){
System.out.println(teacher + "老師在給" + name + "上課!");
}
}
~~~
~~~
// 定義數組
int[] arrs2 = new int[]{1,2,3,4};
int[] arrs = {1,2,3,4}; // 簡寫
int j = 10;
String s1 = "Hello";
String s2 = "Hello";
Student tom = new Student();
tom.name = "tom";
tom.age = 22;
tom.code = "25";
tom.clazz = "Java96";
tom.listen("陸老師");
~~~