摘要: 1 class A { 2 } 3 4 public class NewVarArgs { 5 6 static void printArray(Object... args) { 7 for (Object obj : args) { 8 Sy... 阅读全文
posted @ 2015-04-20 17:08 陶修瑕 阅读(268) 评论(0) 推荐(0) 编辑
摘要: 1 public class ArrayOfPrimitives { 2 3 public static void main(String[]args){ 4 int[]a1={1,2,3,4,5}; 5 int[]a2; 6 a2=a1;... 阅读全文
posted @ 2015-04-20 13:40 陶修瑕 阅读(622) 评论(0) 推荐(0) 编辑
摘要: Create a class with a String field that is initialized at the point ofdefinition, and another one that is initialized by the constructor. What isthe d... 阅读全文
posted @ 2015-04-19 11:05 陶修瑕 阅读(149) 评论(0) 推荐(0) 编辑
摘要: The this keyword is also useful for passing the current object to another method: 1 class Person { 2 public void eat(Apple apple) { 3 Appl... 阅读全文
posted @ 2015-04-19 00:49 陶修瑕 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 1 public class Leaf { 2 3 int i = 0; 4 5 Leaf inceament() { 6 i++; 7 return this; 8 } 9 10 void print() {11 ... 阅读全文
posted @ 2015-04-19 00:33 陶修瑕 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 题目A vampire number has an even number of digits and is formed by multiplying apair of numbers containing half the number of digits of the result. Thed... 阅读全文
posted @ 2015-04-17 12:20 陶修瑕 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 1 import java.util.Scanner; 2 3 public class Fibonacci { 4 5 int fibo(int n) { 6 switch (n) { 7 case 1: 8 return 1;... 阅读全文
posted @ 2015-04-17 11:50 陶修瑕 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 1 package java_test; 2 3 public class labelWhile { 4 5 public static void main(String[] args) { 6 int i = 0; 7 outer: while (tr... 阅读全文
posted @ 2015-04-17 00:37 陶修瑕 阅读(1079) 评论(0) 推荐(0) 编辑
摘要: 1 package java_test; 2 3 public class LabeledFor { 4 5 public static void main(String[]args){ 6 int i=0; 7 outer: //Cannot have... 阅读全文
posted @ 2015-04-17 00:27 陶修瑕 阅读(4719) 评论(0) 推荐(0) 编辑
摘要: 1 public class primeTest { 2 3 public static void main(String[] args) { 4 5 int i, j; 6 for (i = 3; i < 100; i++) { 7 ... 阅读全文
posted @ 2015-04-16 21:32 陶修瑕 阅读(143) 评论(0) 推荐(0) 编辑