易截截图软件、单文件、免安装、纯绿色、仅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 Session and Cookie

一、cookie机制和session机制的区别
*************************************************************************************
具体来说cookie机制采用的是在客户端保持状态的方案,而session机制采用的是在服务器端保持状态的方案。
同时我们也看到,由于才服务器端保持状态的方案在客户端也需要保存一个标识,所以ses ......

[转载]关于Java IO流学习总结

    一、IO流的三种分类方式
    1.按流的方向分为:输入流和输出流
    2.按流的数据单位不同分为:字节流和字符流
    3.按流的功能不同分为:节点流和处理流
    二、IO流的四大抽象类:
    字符流:Reader Writer
& ......

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 ......

java中的foreach用法

 import java.util.*;
public class ForeachExample {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Random r = new Random();
int[] x = new int[10];
for (int i = 0; i < x.length; i++) {
x[i] = r.nextInt(100);
}
/ ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号