目前分類:Java (59)

瀏覽方式: 標題列表 簡短摘要

The form of FileWriter class is as below:

FileWriter(String fileName, boolean append)

JerryCheng 發表在 痞客邦 留言(0) 人氣()

HashTable can improve our search time when we need to find data.
There is a example for HashTable class in java :

import java.util.Hashtable;

文章標籤

JerryCheng 發表在 痞客邦 留言(0) 人氣()

在String類別中的 empty() method可以用來檢查讀到的字串是否為空白行.

Ex :

JerryCheng 發表在 痞客邦 留言(0) 人氣()

There is a file , native2ascii.exe , in jdk bin folder.

We can use this execution file to achieve our purpose.

JerryCheng 發表在 痞客邦 留言(0) 人氣()

http.nonProxyHosts (default: <none>) 

1.  a wildcard character (*) can be used for matching.

JerryCheng 發表在 痞客邦 留言(0) 人氣()

try

{

JerryCheng 發表在 痞客邦 留言(0) 人氣()

try

{

文章標籤

JerryCheng 發表在 痞客邦 留言(0) 人氣()

try 

{

JerryCheng 發表在 痞客邦 留言(0) 人氣()

import java.util.concurrent.TimeUnit;

 

文章標籤

JerryCheng 發表在 痞客邦 留言(0) 人氣()

Java is not like c programming language , it doesn't have the command system("pasue").

But we can use some method to implement the similar function.

JerryCheng 發表在 痞客邦 留言(0) 人氣()

We can use String.split method to split the string into tokens.
 
    String[] result = "this is a book".split("\\s");
     for (int x=0; x<result.length; x++)
    {
         System.out.println(result[x]);
    }
 
The result will be:
this
is
a
book
 
We also can use StringTokenizer class to achieve the result we want.
The StringTokenizer is defined as          StringTokenizer(String str, String delim)
 
code example:
StringTokenizer st = new StringTokenizer("this is a book" , " ");
 while (st.hasMoreTokens()) 
 {
          System.out.println(st.nextToken());
 }
ref:http://docs.oracle.com/javase/7/docs/api/java/util/StringTokenizer.html

JerryCheng 發表在 痞客邦 留言(0) 人氣()

try

{

JerryCheng 發表在 痞客邦 留言(0) 人氣()

try

{

JerryCheng 發表在 痞客邦 留言(0) 人氣()

String inputStr = "ab1da";

Pattern pattern = Pattern.compile("[abc]+\\d[ad]+");

文章標籤

JerryCheng 發表在 痞客邦 留言(0) 人氣()

在java中 , 要進行字串regular expression比對主要有兩種方法 , 

一種是用String中的matches method.

JerryCheng 發表在 痞客邦 留言(0) 人氣()

在Java中 , System.out.print的輸出的default都是在螢幕上 , 

如果我們想要更改輸出位置到file的話 , 我們可以使用以下這個指令:

文章標籤

JerryCheng 發表在 痞客邦 留言(0) 人氣()

1.字串比對

2.字元的輸入

JerryCheng 發表在 痞客邦 留言(1) 人氣()

  • Aug 15 Sun 2010 19:28
  • JAVA

1.System.in

2.Scanner

JerryCheng 發表在 痞客邦 留言(1) 人氣()

不能免俗的,第一篇文章一定要來一個"Hello World!"

public class Hello

JerryCheng 發表在 痞客邦 留言(0) 人氣()

«123