`
chamwarren
  • 浏览: 11304 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论
文章列表
java 垃圾回收总结(1) http://www.cnblogs.com/aigongsi/archive/2012/04/06/2434771.html   java垃圾回收总结(2) http://www.cnblogs.com/aigongsi/archive/2012/04/13/2446166.html

Java初始化顺序

    博客分类:
  • java
 构造是在对象初始化调用。 重载第一个体现是在构造的时候。
import java.util.Scanner; public class Fibonacci { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("pls input number"); int i = sc.nextInt(); for (int j = 1; j <= i; j++) { int num ...
import java.util.Random; public class ForEachFloat { public static void main(String[] args) { Random r = new Random(50); float[] f = new float[10]; for(int i = 0 ; i < 10; i++) { f[i] = r.nextFloat(); } for(float fl: f) { System.out.println("f:"+fl); } } ...

Java ASCII 表

    博客分类:
  • java
public class ListCharacters { public static void main(String[] args) { for (char c = 0; c < 128; c++) { if(Character.isLowerCase(c)){ System.out.print(""+(int)c+":"+c+"\t"); if(((int)c) %5 == 0) { System.out.print("\n"); } ...
1. this :代表对象,所在函数所属对象的引用    在定义功能时,如果该功能内部使用到了调用该功能的对象,这事就用this来表示这个对象    可以用于构造函数的调用  this (实际参数);    this.成员属性/成员方法:    this ...
class Leaf{ int i ; Leaf increment() { i++; return this; } public void print() { System.out.print("i"+i); } public static void main(String[] args) { Leaf lf = new Leaf(); lf.increment().increment().increment(); lf.print(); } }  
class Tree { int height; Tree() { print("Planting a seedling"); height = 0; } Tree(int i) { print("Creating new Tree that is "+ i + " feet tall"); height = i; } public void plant() { print("Tree is " + height + " feet tall& ...
public class CastingNumbers{ public static void main(String[] args) { double above = 0.7; double below= 0.4; System.out.println("above:"+above); System.out.println("below:"+below); System.out.println("(int)above:"+(int)above); System.out.println(&qu ...
  public class VowelsAndConsonants { public static void main(String[] args) { for (int i =0 ; i < 100 ; i++ ) { char c = (char)(Math.random()*26+ 'a'); switch(c) { case 'a': case 'e': case 'i': case 'o': case 'u':System.out.println("Vowels"); ...
Global site tag (gtag.js) - Google Analytics