import java.util.TreeSet;import java.util.Iterator;public class TestTreeSet{ public static void main(String[] args) { TreeSet ts = new TreeSet(); ts.add("orange"); ts.add("banana"); ts.add("apple"); ts.add("grape"); Iterator it = ts.iterator(); ...
package com.yds.review.list11;import java.util.Date;import java.util.HashSet;import java.util.Iterator;public class TestHashSet{ public static void main(String[] args) { HashSet h = new HashSet(); h.add("1st"); h.add("2nd"); h.add(new Integer(3)); h.add(new...
import java.util.Date;import java.util.ArrayList;import java.util.Vector;import java.util.Iterator;public class TestIterator{ public static void main(String[] args) { ArrayList a = new ArrayList(); a.add("China"); a.add("USA"); a.add("Korea"); Iterator it...
import java.util.Date;import java.util.Stack;public class TestStack{ public static void main(String[] args) { Stack s = new Stack(); s.push("hello"); s.push(new Date()); s.push(400); //自动封装,等价于s.push(new Integer(400)); s.push(3.14); System.o...
package com.yds.review.list11;import java.util.Date;import java.util.Vector;public class TestVector{ public static void main(String[] args) { Vector v = new Vector(); v.add("1st"); v.add("2nd"); v.add(new Integer(3)); v.add(new Double(4.0)); v.add("2...
package com.yds.review.list11;import java.util.Date;import java.util.ArrayList;public class TestArrayList{ public static void main(String[] args) { ArrayList h = new ArrayList(); h.add("1st"); h.add("2nd"); h.add(new Integer(3)); h.add(new Double(4.0)); ...
package com.yds.gui.applet;import java.awt.Color;import java.awt.Container;import java.awt.GridLayout;import javax.swing.JFrame;import javax.swing.JLabel;public class JFtext1 { /** * @param args */ public static void main(String[] args) { JFrame jf=new JFrame(); Cont...
package com.yds.gui.fourpart;import java.awt.Button;import java.awt.FileDialog;import java.awt.Frame;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;public class FileSave implements ActionListener{ Button b1,b2; FileDialog f_open,f_save; Frame f; public void Ui(){...
import java.awt.*;import java.awt.event.*;public class TestDialog implements ActionListener{ private Label info; private Dialog loginDialog; private Dialog quitDialog; private TextField tf_name; private TextField tf_psw; public static void main( String args[]) { new Tes...
package com.yds.gui.twopart;import java.awt.*;import java.awt.event.*;public class TestChoice implements ItemListener,ActionListener{ TextField name; CheckboxGroup cg; Choice career; List city; Checkbox[] favorite; public static void main( String args[]) { new TestChoic...
package com.yds.gui.fourpart;import java.awt.Button;import java.awt.Checkbox;import java.awt.CheckboxGroup;import java.awt.Choice;import java.awt.FlowLayout;import java.awt.Frame;import java.awt.GridLayout;import java.awt.Label;import java.awt.List;import java.awt.Panel;import java.awt.TextFiel...
public static void main(String[] args) { Frame f=new Frame("记事本"); MenuBar mb=new MenuBar(); Menu m1=new Menu("打开"); MenuItem mi1=new MenuItem("打开"); MenuItem mi2=new MenuItem("保存"); MenuItem mi3=new MenuItem("另存为"); MenuItem mi4=new MenuItem("退出"); Monst...
package com.yds.gui.fourpart;import java.awt.Button;import java.awt.Frame;import java.awt.Panel;import java.awt.TextArea;import java.awt.TextField;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;public class TextAreaBea { Frame f; TextArea ta; Button b; TextFie...
import java.awt.*;import java.awt.event.*;
public class TestTextField implements ActionListener{ TextField name; TextField password; public static void main( String args[]) { TestTextField ttf = new TestTextField(); ttf.createUI(); } public void createUI(){ Frame f = new Frame("登录界面"); ...
转载:被127次掌声打断的浙江大学教授郑强的经典语录1.日本人宁愿喜欢黑人,也不喜欢我们,因为现在的中国人没有了精神。2.大家都在嘲笑俄罗斯,但我知道俄罗斯将来一定会发达,因为那里的人2天没吃饭了饿着肚子还排队,而我们有2个人也要挤的不可开交。3.日本人侵犯我们,因为我们出了很多汉奸。将来日本人侵犯我们,还会不会有汉奸?谁将是未来中国的汉奸?在座的诸位很大一部分都将是。因为你们嘲笑爱国者,崇拜权势和金钱,鄙夷理想和志气。4.谁现在就是汉奸?北大清华的学生,因为用他们学习的知识帮外国人开拓市场,打败我们中国的企业5.我们漠视历史的价值,总以为楼宇越新越好,但你到法国市中心看看,几乎没有什么...
package com.yds.gui.threepart;
import java.awt.Button;import java.awt.Frame;import java.awt.GridLayout;import java.awt.Panel;import java.awt.TextField;
public class Jishuan { static Button b1, b2, b3, b4, b5, b6, b7, b8, b9; static Button b11, b12, b13,b14;
public static void main(String[] ar...
package com.yds.javatalk;
import java.awt.Button;import java.awt.Frame;import java.awt.Panel;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;
public class ButtonTest extends Frame implements ActionListener { Button b1,b; ButtonTest(){ Panel p=new Panel(); b=new Button...
标准的输入格式InputStreamReader isr=new InputStreamReader(System.in); BufferedReader br=new BufferedReader(isr);
从Socket中得到的标准输出格式
PrintWriter pw=new PrintWriter(s.getOutputStream());//s为Socket对象名
从Socket中得到的标准输入格式
BufferedReader bw=new BufferedReader(new InputStreamReader(s.getInputStream()));
...
import java.io.IOException;import java.net.DatagramPacket;import java.net.DatagramSocket;import java.net.InetAddress;import java.net.SocketException;public class UdpClient { public static void main(String[] args) { try { DatagramSocket ds = new DatagramSocket(); ...
public void actionPerformed(ActionEvent e) { // System.out.println(); if (e.getActionCommand().equals("启动服务")) { System.out.println("已经进来了"); System.out.println(this.tf1); } // } else if (e.getActionCommand().equals("停止服务")) { // System.out.println("!!!!!!!"); // } else if (e.getActi...