public class Test
{
public static void main(String[] args)
{
Human aPerson = new Human(160);
System.out.println(aPerson.getHeight());
}
}
class Human
{
/**
* constructor
*/
Human(int h)
{
this.height = h;
System.out.println("I'm born");
}
/**
* accessor
*/
int getHeight()
{
return this.height;
}
int height;
}
public class Test
{
public static void main(String[] args)
{
Human aPerson = new Human(160);
System.out.println(aPerson.getHeight());
}
}
class Human
{
/**
* constructor
*/
Human(int h)
{
this.height = h;
}
/**
* accessor
*/
int getHeight()
{
return this.height;
}
int height=170; // explicit initialization
}
public class Test
{
public static void main(String[] args)
{
Human neZha = new Human(150, "shit");
System.out.println(neZha.getHeight());
}
}
class Human
{
/**
* constructor 1
*/
Human(int h)
{
this.height = h;
System.out.println("I'm born");
}
/**
* constructor 2
*/
Human(int h, String s)
{
this.height = h;
System.out.println("Ne Zha: I'm born, " + s);
}
/**
* accessor
*/
int getHeight()
{
return this.height;
}
int height;
}
public class Test
{
public static void main(String[] args)
{
Human aPerson = new Human();
aPerson.breath(10);
}
}
class Human
{
/**
* breath() 1
*/
void breath()
{
System.out.println("hu...hu...");
}
/**
* breath() 2
*/
void breath(int rep)
{
int i;
for(i = 0; i < rep; i++) {
System.out.println("lu...lu...");
}
}
int height;
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有