作者:丢失时 | 来源:互联网 | 2023-10-10 12:00
packagecom.bjsxt.test3;publicclassSxtStu{属性intid;Stringsname;intage;方法voidstudy(){System.o
package com.bjsxt.test3;public class SxtStu {//属性int id;String sname;int age;//方法void study() {System.out.println("我在学习,正在敲代码,正在听课!!不要打扰我!");}//构造方法(方法名和类名保持一致!)SxtStu(){}public static void main(String[] args){SxtStu s1 = new SxtStu();System.out.println(s1.id);System.out.println(s1.sname);s1.id = 1001;s1.sname1 = "靓仔";System.out.println(s1.id);System.out.println(s1.sname);}}