?? client.java
字號:
import java.io.DataInputStream;import java.io.PrintStream;import java.net.Socket;/* * To change this template, choose Tools | Templates * and open the template in the editor. *//** * * @author root */public class Client { public static void main(String[] args) throws Exception { Socket S=new Socket("localhost",5555); PrintStream sout=new PrintStream(S.getOutputStream()); DataInputStream sin=new DataInputStream(S.getInputStream()); DataInputStream in=new DataInputStream(System.in); int opt=-1; do{ System.out.println("\nMENU\n****\n1.Deposit\n2.WithDraw\n3.Balance\n4.Exit\nEnter Ur Option:"); opt=Integer.parseInt(in.readLine()); int amt=0; switch(opt) { case 1: System.out.println("Enter the Amount:"); amt=Integer.parseInt(in.readLine()); sout.println("1"); sout.println(amt+""); System.out.println("From Server:"+sin.readLine()); break; case 2: System.out.println("Enter the Amount:"); amt=Integer.parseInt(in.readLine()); sout.println("2"); sout.println(amt+""); System.out.println("From Server:"+sin.readLine()); break; case 3: sout.println("3"); System.out.println("From Server:"+sin.readLine()); break; case 4: opt=-1; break; } }while(opt!=-1); sout.close(); in.close(); }}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -