原创 Java Puzzlers筆記--Puzzle 1: Oddity奇偶問題

public static boolean isOdd(int i){    return i%2 == 1;} Solution:    以上程序只

原创 java 6的認識

剛剛看完csdn上的文章介紹java虛擬機,覺得講到java 6的一點新功能,我們必須知道的,要不我們就out了... 文章是一篇Danny Coward訪問;英文的原連接 http://www.artima.com/lejava/art

原创 Java Puzzlers筆記--Puzzle 2: Time for a change 關於浮點型的問題

public class Change{    public static void main(String[] args){       Syst

原创 Java Puzzlers筆記--puzzle 19: Classy Fire 註釋問題

public class Classifier{    public static void main(String[] args){       System.out.println(classify('n') + classify('

原创 puzzle 18: String Cheese String的構造

 public class StringCheese{ public static void main(String[] args){  byte[] bytes = new byte[256];  for(int i = 0; i<25

原创 Java Puzzlers筆記--puzzle 17: Huh? 轉義字符問題

Is this a leage Java Program? if so, what does it print?/u0070/u0075/u0062/u006c/u0069/u0063/u0020/u0020/u0020/u0020/u0

原创 Java Puzzlers筆記--puzzle 12: ABC String與char的區別

public class Abc{ public static void main(String[] args){  String letters = "ABC";  char[] numbers = {"1", "2", "3"};  

原创 Java Puzzlers筆記--puzzle 22:Dupe of URL url的使用

public class BrowserTest{ public static void main(String[] args){  System.out.println("iexplore.exe");  http://www.goog

原创 Java Puzzlers筆記--puzzle 15: Hello Whirled -Unicode字符問題

 /** * Generated by the IBM IDL-to-Java compiler, version 1.0 * from F:/TestRoot/apps/a1/units/include/PolicyHome.idl *

原创 puzzle 16: Line Printer 轉義字符

 public class LinePrinter{    public static void main(String[] args){        //Note: /u000A is Unicode representation o

原创 Java Puzzlers筆記--puzzle 7: Swap Meat ^符號問題

public class CleverSwap{ public static void main(String[] args){  int x = 1984;  int y = 2001;  x ^= y ^=x ^= y;  Syste

原创 Java Puzzlers筆記--puzzle 21: What's my Class, take 2 路徑字符問題

package com.javapuzzlers;import java.io.File;public class MeToo{   public static void main(String[] args){      System.

原创 Java Puzzlers筆記--Puzzle 3: Long Division 溢出問題

public  class LongDivision{    public static void main(String[] args){       final long MICROS_PER_DAY

原创 Java Puzzlers筆記--puzzle 8: Dos Equis 選擇操作符問題

public class DosEquis{ public static void main(String[] args){  char x = 'X';  int i = 0;  System.out.println(true  ? x

原创 Java Puzzlers筆記--puzzle 9: Tweedledum +=的問題

 Provide declarations for the variables x and i such that this is a legal statement:  x += i;but this is not: x = x + i