public class EchoClient {
public static void main(String[] args) throws IOException {
Socket echoSocket = null;
PrintWriter out = null;
BufferedReader in = null;
try {
echoSocket = new Socket(”taranis”, 7);
out = new PrintWriter(echoSocket.getOutputStream(), true);
in = new BufferedReader(new InputStreamReader(
echoSocket.getInputStream()));
} catch (UnknownHostException e) {
System.err.println(”Don’t know about host: taranis.”);
System.exit(1);
} catch (IOException e) {
System.err.println(”Couldn’t get I/O for ”
+ “the connection to: taranis.”);
System.exit(1);
}
BufferedReader stdIn = new BufferedReader(
new InputStreamReader(System.in));
String userInput;
呀sir ar~~~~~ help!!!!!我都係唔識整果個java既path呀!!
點算ar >.That’s the display on my computer
Nicholas
10 Sep 07 at 21:19
我set兩個path的方法:
1.開始,搜尋,所有檔案和資料夾,search “javac”
搵到之後,right click個檔案,內容,copy佢個位置;
再按開始,執行,打”cmd”,出左個Dos(黑畫面),打”path 「你果個位
置」”,咁就應該可以set到javac既path了。
2.Set compile file path,即係將java轉class的過程。當你寫完個
java,save左檔案,right click個檔案,內容,copy佢個位置;
再按開始,執行,打”cmd”,出左個Dos(黑畫面),打”cd 「你果個位
置」”,再打”javac 你個file name”,such as”pong.java”;咁就應該
可以set到compile file path,而且可以complie java file to
class file.
pong
11 Sep 07 at 14:25
import java.util.Scanner; //Use class “Scanner”
public class test
{
public static void main(String args[])
{
Scanner input = new Scanner(System.in);
int base;
int height;
int sum;
System.out.print(”Base=”);
base = input.nextInt(); //enter the base
System.out.print(”Height=”);
height = input.nextInt(); //enter the height
sum = base + height; //cuclate what the sum is
System.out.printf(”Sum=”,sum); //display the sum
} //end method main
} //end class test
//the sum cannot show out
Nicholas
12 Sep 07 at 16:45
呀sir, 我整完個path都係咁既死樣(唔得~~)。係cmd到打”javac” 佢係度話呢個唔係指令!!!
我果個path原本係”%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Common Files\Adobe\AGL”
之後我咪係最尾個度加左java果段野:
“%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Common Files\Adobe\AGL;C:\Program Files\Java\jre1.6.0_2″
但係都係唔得,我真係唔明點解
Nicholas
12 Sep 07 at 19:51
//Sir, 唔知呢段有冇啲野可以參考ar?
import java.io.*;
import java.net.*;
public class EchoClient {
public static void main(String[] args) throws IOException {
Socket echoSocket = null;
PrintWriter out = null;
BufferedReader in = null;
try {
echoSocket = new Socket(”taranis”, 7);
out = new PrintWriter(echoSocket.getOutputStream(), true);
in = new BufferedReader(new InputStreamReader(
echoSocket.getInputStream()));
} catch (UnknownHostException e) {
System.err.println(”Don’t know about host: taranis.”);
System.exit(1);
} catch (IOException e) {
System.err.println(”Couldn’t get I/O for ”
+ “the connection to: taranis.”);
System.exit(1);
}
BufferedReader stdIn = new BufferedReader(
new InputStreamReader(System.in));
String userInput;
while ((userInput = stdIn.readLine()) != null) {
out.println(userInput);
System.out.println(”echo: ” + in.readLine());
}
out.close();
in.close();
stdIn.close();
echoSocket.close();
}
}
Nicholas
14 Sep 07 at 15:31
jre裡面係冇javc程式既,要響jdk裡面先有
“%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Common Files\Adobe\AGL;C:\Program Files\Java\jre1.6.0_2″
所以首先你要搵番jdk file,然後link番落去,咁先可以行到javac.
pong
28 Sep 07 at 9:47