易截截图软件、单文件、免安装、纯绿色、仅160KB

java中this关键字用法

 /**
* this关键字用法
*/
public class Flower {

int petalCount = 0;
String s = "initial value";

Flower(int petals){
petalCount = petals;
System.out.println("Constructor with one int arg");
}

Flower(String ss){
System.out.println("Constructor with one string arg");
s = ss;
}

Flower(String ss, int petals){
this(petals);
this.s = ss;
System.out.println("Constructor with string and int args");
}

Flower(){
this("hi",47);
System.out.println("Default Constructor with no args");
}

void printPetalCount(){
System.out.println("petalCount = "+petalCount+"; s = "+s);
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Flower x = new Flower();
x.printPetalCount();
}



相关文档:

Java 解压rar文件的经典实例

2009-11-11  18:06:09
/**
*
* @author Ice*
*/
public class RarUtil{
public static void main(String args[]) throws Exception {

String compress = "D:\\test.rar";// rar压缩文件
String decompression = "D:\\";// 解压路径
unZip(compress, decompression);

}
/** ......

java exception java异常汇总(1)

 java exception 解决方案 - 我的异常网|异常|exception 730 - org.hibernate.LazyInitializationException:could not initialize proxy 731 - 警告: Error setting value 732 - override and commit 733 - Building workspace has encountered a problem. Errors during build 734 - Could not open the editor: An ......

java exception java异常汇总(1)

 java exception 解决方案 - 我的异常网|异常|exception 730 - org.hibernate.LazyInitializationException:could not initialize proxy 731 - 警告: Error setting value 732 - override and commit 733 - Building workspace has encountered a problem. Errors during build 734 - Could not open the editor: An ......

从C++到JAVA(1) 在CSDN博客中部署及运行JAVA Applet

write by 九天雁翎(JTianLing) -- blog.csdn.net/vagrxie 讨论新闻组及文件 Technorati 标签: JAVA,JAVA Applet,Applet Tag,Deploy Applet,从C++到JAVA   前言 曾经,我有一个梦想,那就是我的程序能让人不需要下载就能通过浏览器运行,可惜学习的C,C++等都不具备此能力,学习完Python后,发现其也仅仅是以服务器 ......

java 找出4位数的所有吸血鬼数字

 /**
* 找出四位数所有的吸血鬼数字
* 吸血鬼数字:位数为偶数的数字可以由一对数字相乘而得,这对数字包含乘积一半的位数
* 如:1260 = 21*60
*/
public class Vampire {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub

String s= ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号