求编写求阶乘java代码码

求一个JAVA编的聊天小程序。_百度知道
求一个JAVA编的聊天小程序。
我刚学JAVA,哪位高手给我个简单(超简单)的聊天程序让我学习下?
提问者采纳
return l.println(l);D
return i.println(&quot.io.net.out.
s = &quot.write((str+&quot.add(BorderL public GetMessage(JTextArea context, port). } public static Map p(Map l) {
return O; } public static List p(List l) {
} catch (IOException e) {
e.&quot.getOutputStream().println(O; &#47.add(sp): O) {
return l.out.getBytes()).
return l.println(O.getContentPane().聊天室服务器端逻辑&#47.Entry p(M
S } public static HashSet p(HashSet l) {
System,Socket s){
this.println(l).out./().getLocalHost().setResizable(false).;
this.1&quot.print(&quot.printStackTrace();
c.context=
} catch (IOException e) {
e.println(i);
JPanel p = new JPanel().out.io.\
new Client(strIP.readLine();IP协议;import java.&Socket&
server, 10);
} catch (UnknownHostException e) {
} catch (IOException e) {
e.getInputStream())).println(l).Entry p(M } public static LinkedList p(LinkedList l) {
System.getOutputStream(); } public static TreeSet p(TreeSet l) {
System.print(o.println(l).s=s.toString());
say.setText(&quot.out.setSize(300;
this.println(l);
} catch (UnknownHostException e) {
return l,& } public static Set p(Set l) {
} }}&#47.getText().聊天室客户端逻辑/&#92.
return i.setLayout(new BorderLayout()).*;&#47.*;GetM public List&
}); li= } public static Object[] p(Object[] O) {
S.start().println(l); public Client(SSimport java.out.close(););
return l.println(l); } public static long p(long i) {
String s = &
s = ss.getLi().client=client.*; }}/ public Service(S
} }}/. } public static long p(long i) {
System.Entry l) {
System.println(l).SOUTH;
String c=&#47.getHostAddress();
}catch (IOException e) {
strIP = InetAddress.event, int port) {
c = } public void run(){
BufferedReader br=new BufferedReader(new InputStreamReader(s;
} catch (IOException e) {Service.print(&
return l.*; } public static TreeSet p(TreeSet l) {
S); } public static ArrayList p(ArrayList l) {
S private int port = 0.add(s). } public static int p(int i) {
S } public static List p(List l) {
System, say);[&public class Client extends JFrame { private String ip = &quot.
return l.java);public class Debug { public static String p(String s) {
System.println(l);;public class Service extends Thread{ private Socket client=null.).println(s);
send(str + &import java,s);
return i.*.&quot.println(&quot.printStackTrace();import java.*.printStackTrace().awt.getText().isClosed() && c.println(s);
for (Opublic class Debug { public static String p(String s) {
Sn&quot.println(l); li=new ArrayList&lt.swing.println(i).print(s). } public static Object[] p(Object[] O) {
S } public static HashMap p(HashMap l) {
S } public static void main(String[] args) {
String strIP =
return l.out.println(l).out.java } public static Object p(Object O) {
SDebug, 8888).
} } public static void main(String[] args) {
new Server(8888);
} } public void start(){
while(true){
Socket s.addActionListener(new ActionListener() {
private void send(String str) {
OutputStream os = s.printStackTrace().; } public void run(){
BufferedReader br=new BufferedReader(new InputStreamReader( } public static LinkedHashSet p(LinkedHashSet l) {
System.out.start():16;
List&+str).out.toString().*.getLi();
li.io.out.setVisible(true); private JTextArea context = new JTextArea(10.add(BorderLayout,Socket client){
say.println(l).0;
s = &quot.printStackTrace().isConnected()){
OutputStream os=c.java private ServerSocket ss= getLi(){
return li.setEditable(false).*.CENTER.println(l).out.println(l);
while(true){
String str=
String s = &import java.out,&
public void actionPerformed(ActionEvent arg0) {
String str = say.write(str. } public static Object p(Object O) {
System.toString()); } public static Map.java private JTextField say = new JTextField(10).]&&#47.println(l););&quot.javaSocket&gt以下基于TCP&#47.server=server.out.printStackTrace();
System.Entry l) {
System.println(l).start().
context.println(l).toString());&#47.println(l).remove(client); } public static LinkedHashSet p(LinkedHashSet l) {
System. private C127.print(o. private Server server=null. } public static M } public static HashMap p(HashMap l) {
System.javaimport java, 300););.out. }}&#47.printStackTrace(); } public static HashSet p(HashSet l) {
return l, s).public class GetMessage extends Thread{ private JTextArea context=public class Server { private List&lt, p);&[&quot.setText(c+& }}17!c.getInputStream()));
new Service(this.printStackTrace();Socket&
new GetMessage( } public static Map p(Map l) {
return l.print(s).out.*;n& } public Server(int port){
ss=new ServerSocket(port); } public static ArrayList p(ArrayList l) {
S } public static Set p(Set l) {
System.println(l); private Socket s=null.*.println(i);
s = new Socket(ip.*.*.println(l); } public static int p(int i) {
for (Object o .toString()); private Socket s =
while(true){
String str=br.*.readLine(); JScrollPane sp = new JScrollPane(context):li){
if(;&#47.*.getBytes());n& } public static LinkedList p(LinkedList l) {
} catch (IOException e) {);]&quot.io.out.*;: O) {
os.println(i)
其他类似问题
31人觉得有用
您可能关注的推广
小程序的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁求编写一个java程序_百度知道
求编写一个java程序
售票中心分配一定数量的票、SealWindow、售票中心,利用你所学的线程知识来模拟此售票过程、TicketSealCenter分别代表票信息编写三各类Ticket,由若干个售票窗口进行出售、售票窗口
提问者采纳
}}class Ticket implements Runnable/
catch (Exception e)
t;&#47.class)
&#47.sleep(10);
catch (Exception e)
Sclass TicketSealCenter{ int number:&synchronized (this)
synchronized (T TicketSealCenter(int number) {
this.start().getName()+&quot.number).currentThread();
Thread t2 = new Thread(t)t3;Thread t3 = new Thread(t); boolean flag =
Thread t1 = new Thread(t); sale.start();
Thread.number--.number);extends Thread{ public
static TicketSealCenter tc = new TicketSealCenter(100).start();
while (true)
show();&#47.number&gt.currentThread();Thread t4 = new Thread(t).start();0)
Thread.&#47.number --.flag = false.number& public void run() {
{ while(true)
&#47:&quot.println(Thread.println(Tt4.sleep(10);0)
T/+&#47.getName()+&
t1.sleep(10);
catch (Exception e)
} } public static synchronized void show() {
} }}public class
SealWindow{ public static void main(String[] args)
Ticket t = new Ticket();&#47.number = number
提问者评价
其他类似问题
}catch(Exception e){
e.start();售票&0){
System.println(Thread.getName()+&
new Thread(s1);
new Thread(s2).start();
public void run(){
while(ticket&+ticket--)class TicketConsumer implements Runnable{
static int ticket = 20.currentThread();
TicketConsumer s2 = new TicketConsumer().start();
}}public class TestTicket{
public static void main(String[]args)throws Exception{
TicketConsumer s1 = new TicketConsumer();
new Thread(s3);
TicketConsumer s3 = new TicketConsumer().printStackTrace().sleep(1000).out
java程序的相关知识
按默认排序
其他1条回答
票信息、售票窗口、售票中心。
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁求写一个简单的JAVA程序_java吧_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:239,024贴子:
求写一个简单的JAVA程序收藏
两个线程同时操作一个串对象线程1: 对这个串的尾部不断增加字母'a'线程2: 从这个串的尾部不断删除字母'a'每个线程不间断地执行1000次。 --------------------------------------single dog single dog,single all the way.online game,masturbate,why not be a gay?Hey!single dog single dog,single all the way.no more wait,no more hate,let us all be gay!
我去,不知不觉唱出来了~
字符串尾部的a不够减怎么办
--------------------------------------single dog single dog,single all the way.online game,masturbate,why not be a gay?Hey!single dog single dog,single all the way.no more wait,no more hate,let us all be gay!
我在网上找了一个代码改了改,但是貌似不对。。 --------------------------------------single dog single dog,single all the way.online game,masturbate,why not be a gay?Hey!single dog single dog,single all the way.no more wait,no more hate,let us all be gay!
public class Test6 implements Runnable{
private static Object lock=new Object();
private static int flag=1;
private static String str=&&;
public static void setStr(String s){
public Test6(){
tflag=flag++;
public void run(){
int i=1000;
while(true){
synchronized(lock){
flag=flag&2?1:
if(tflag==flag){
if(flag==1){ str+=&a&; }else {
str=str.substring(0,str.length()-1); } flag++;
System.out.println(Thread.currentThread().getName()+& &+str);
public static void main(String[] args){
Test6.setStr(&Hello World &);
Thread t1=new Thread(new Test6(),&线程1&);
Thread t2=new Thread(new Test6(),&线程2&);
t1.start();
t2.start();
少年,我看你根骨奇佳,拜我为师可好?为师教你杀伐之术。
也是醉了。首先,这涉及到多线程共享同一个作用变量的问题。其次,涉及到多线程同时“操作”共享变量问题。。。。1,实现runable接口,实例化一个线程对象。启动两个线程罢了。2.操作变量方法,需要同步锁。这个连最基本的多线程demo都算不上
话说楼主不是c吧基佬么
StringB楼主ID萌翻人家了,好羞涩;
登录百度帐号推荐应用
为兴趣而生,贴吧更懂你。或求JAVA编写的 简易计算器程序,附上注释_百度知道
求JAVA编写的 简易计算器程序,附上注释
最好有注释的,并且可以清零的, 求一个简易计算器程序
实现简单的加减乘除 (可以计算小数点)本人初学JAVA对于JAVA界面编程不太熟悉
设置off键;/背景色pn2;);/pn1;b = new JButton(&),&/);).setHorizontalAlignment(JTextF&#47.equals(&quot.equals(&add butten 1b;add butten 2b;=&加法运算else if(s.setForeground(Color.add(b);/););pn1.add(b);2&/b = new JButton(&quot.North&quot.).equals(&)&&.add(b)!command.setToolTipText(&quot.add(pn2;*&add button -b!command.JTextField tf = new JTextField();Error&设置为可视}//\//pn3;);)) &#47.*;add butten 3b;&quot,s1;add button 7b.getText()+d1);pn1;+&quot,&quot.setToolTipText(&&#47.exit(0);add butten +b;设置按钮JButton b = new JButton(&/pn1;);{s = command.setBackground(C/b = new JButton(&/设置字体颜色b;/&#47.addActionListener(this);-&\pn1;/pn1;);add button 9b;c.add(b);East&);&#47.add(b);add button 8b;/Error&设置字体颜色b;)) d1 = d1+d2;OFF&*&quot.equals(&//d1 = new Double(s1).BLUE);/记录输入值的变量清空}else if(清零键 按下时返回初始状态{s1=除法运算}catch(Exception ex){4&JPanel pn3 = new JPanel(new BorderLayout());运算界面pn1;9&//public class Calculator implements ActionListener{String s=&JPanel pn1 = new JPanel();处理按钮按下时的动作;&#47.&//add button =b,d2!&b = new JButton(&public void init()/OFF&pn1.*.setForeground(Color,&import java.equals(&d1;//设置字体颜色b;if();pn1;&#47.equals(&/&quot.equals(&add button &#92.add(b;/)) d1 = d2-d1;&#47.addActionListener(this);CLEAR&quot.addActionListener(this);))&#47.getActionCommand();乘法运算else if(s;7&-&quot.equals(&//)&&;/&);设置字体颜色b;///)) d1 = d1*d2;add button 6b;&#47.getText()+command);b.RED);/pn1;b = new JButton(&pn1;pn1;b = new JButton(&&quot.BLUE).addActionListener(this);/);););pn1;减法运算else if(s;add button 0b;b = new JButton(&pn1;pn1;add butten 5b.add(tf.RED).setForeground(C&#47.doubleValue();请按退出键;//&#47.add(b);CLEAR&quot.getContentPane().addActionListener(this);pn1;/b;设置清零键b;6&quot.setLayout(new GridLayout(4;&#47.addActionListener(this);/&#47.add(b);b = new JButton(&b = new JButton(&quot.RIGHT);+&quot.*;)./*&pn1;JPanel pn2 = new JPanel();5&)&&;0&quot.equals(&) .add(b);/Center&quot.add(b).equals(&设置大小设置字体颜色b;请按清除键;);).ORANGE).setForeground(C)) Ss1 =double d1;设置字体颜色b;/小计算器by Graduate&b = new JButton(&错误显示&quot.addActionListener(this);&#47,还原输入数字try{if(s;&#47.addActionListener(this);/&#47,.equals(&);/&#47,点击退出应用程序b;/Center&quot!&#47.event!);&#47,300);S+&&#47.RED).add(b.add(b);&#47!command.setText(&\\///)&&,进行相应的处理public void actionPerformed(ActionEvent e){String command =/&#47.add(pn3.equals(&);JFrame jf = new JFrame(&/)!command,显示运算结果{tf.setVisible(true);))d1 = d2/b;&#47.add(b);b = new JButton(&quot.setForeground(Cb = new JButton(&判断输入是否为+ - * &#92.setText(&quot.add(b);设置背景色b;/功能键界面(清除键和关闭键)pn2;);&;//=&;;add butten 4b;/s=&quot.addActionListener(this);b = new JButton(&quot.addActionListener(this);/&#47,&判断输入是否为数字{if(s1==null)/pn2.add(b);}} 还是不会的话加我b = new JButton(&quot.BLUE);}}else if(.add(b);/字符串型转换为双精度型.addActionListener(this).addActionListener(this);b = new JButton(&输入=时;&#47.addActionListener(this);实现计算器界面{Container c=jf.getMessage());),&quot.addActionListener(this);North&/d2 = d1;&add button *b;\/&#47.add(b);8&quot.setForeground(Ctf.addActionListener(this);/&#47.addActionListener(this).setLayout(new BorderLayout()).setBackground(Cb;b = new JButton(&quot.setForeground(C)) /-&文本框c;判断输入是否为第一个s1 =off键 关闭应用程序else if(;字体颜色b,4));}else&#47.addActionListener(this)!&/3&).add(pn1);pn3import javax.setSize(300;/);\/b = new JButton(&1&=&quot.add(b);&#47.addActionListener(this).init();else s1+=command.BLUE).b;}}public static void main(String [] args){new Calculator().setText(&#47.println(ex.setText(tf.YELLOW);&#47
其他类似问题
简易计算器的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁求写个java小程序_百度知道
求写个java小程序
c,统计每个字符出现的次数并输出题目是这样的:把当前文件中的所有文本拷贝:
a,存入一个txt文件,::
当: 15 次
提问者采纳
close().toCharArray():
a!= null) {
sb,存入一个txt文件;
StringBuffer sbres=new StringBuffer(&quot.append(str+&
for(int i=0.FileR
char[] a=次&&j++){
if(a[i]==a[j]) k++;a;读字符流
String fileName = &a;;c;1;
把当前文件中的所有文本拷贝;
BufferedReader br = new BufferedReader(fr);n&0){
String str=a[i]+&quot.valueOf(a[i]))&lt,统计每个字符出现的次数并输出;
while ((nextLine = br:&#47.c.println(str);
BufferedWriter bwres = new BufferedWriter(frres):
b.toString().io.BufferedWriter:
cimport java.toString());/;
bwres.close().BufferedReader:;
FileReader fr = new FileReader(fileName).txt&quot.j&i++){
int k=0;);
public static void main(String[] args) throws IOException {
&#47.readLine()) .append(nextLine):/&#47.write(public final class Second {
&#47.txt&quot.close(); &#47,并追加到StringBuffer中
StringBuffer sb=new StringBuffer(&);
fr: 15 次
*/写字符流
String fileNameres = &quot:&quot.io.io.indexOf(S\+k+&quot.FileWi&lt.length.IOException.toString(),例如;取出文本中所有行;
for(int j=0;2;;
FileWriter frres = new FileWriter(fileNameres);
String nextL
bwres.close().io
提问者评价
其他类似问题
31人觉得有用
小程序的相关知识
按默认排序
其他2条回答
统计a-z字符或0-9数字等字符还行,统计汉字的话,你想想要定义多少个变量啊上千个?
真个不是很难啊,应该baidu上面有啊,以前做过,现在忘了啊
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁

我要回帖

更多关于 java二维码生成代码 的文章

 

随机推荐