public class ThisDemo {
String name="Mick";
public void print(String name){
System.out.println("类中的属性 name="+this.name);
System.out.println("局部传参的属性="+name);
}
public static void main(String[] args) {
ThisDemo tt=new ThisDemo();
tt.print("Orson");
}
}
public class ThisDemo {
int number;
ThisDemo increment(){
number++;
return this;
}
private void print(){
System.out.println("number="+number);
}
public static void main(String[] args) {
ThisDemo tt=new ThisDemo();
tt.increment().increment().increment().print();
}
}
public class ThisDemo {
String name;
int age;
public ThisDemo (){
this.age=21;
}
public ThisDemo(String name,int age){
this();
this.name="Mick";
}
private void print(){
System.out.println("最终名字="+this.name);
System.out.println("最终的年龄="+this.age);
}
public static void main(String[] args) {
ThisDemo tt=new ThisDemo("",0); //随便传进去的参数
tt.print();
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有