易截截图软件、单文件、免安装、纯绿色、仅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面试题及答案(基础题122道,代码题19道)

 JAVA相关基础知识
1、面向对象的特征有哪些方面
1.抽象:
抽象就是忽略一个主题中与当前目标无关的那些方面,以便更充分地注意与当前目标有关的方面。抽象并不打算了解全部问题,而只是选择其中的一部分,暂时不用部分细节。抽象包括两个方面,一是过程抽象,二是数据抽象。
2.继承:

承是一种联结类的层 ......

java 连接 sap

源代码:
 import com.sap.mw.jco.*;
public class control extends Object
{
public static void main (String str[])
{
 control control=new control();
}
int count;
JCO.Client mConnection;
JCO.Repository mRepository;
String[] SAPInterfaces;
public control()
{
   try {
& ......

java 找出100以内的素数

 public class FindPrime {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int num = 100;
String s = "100以内的素数:";
for (int i = 1; i <= num; i++) {
int count = 0;
for (int j = 1; j <= (int) Math.s ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号