摘要:
java是传值还是传址,这个问题已经讨论了很久了,有些人说是传值的,有些人说要看情况,有些情况是传值,有些情况是传址。到底是传值还是传址呢?我们暂时先把传址理解为C++的传指针一样.....先看下面一段程序:
package luojing;
public class StringDemo
{ public static void main(String[]args) { String str=new String("hello"); //调用函数改变str的值 change(str); System.out.println(str); } public st... 阅读全文
摘要:
生产者类:package luojing; public class producer implements Runnable { private box ss; public producer(box ss) { this.ss=ss; } public void run() { char c; for(int i=0;i<10;i++) { c=(char)(Math.random()*26+'A'); ss.put(c); try { Thread.sleep((int)(Math.random()*300)); ... 阅读全文
摘要:
package test; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.image.BufferedImage; import java.io.OutputStream; import java.util.Random; import javax.imageio.ImageIO; import javax.servlet.http.HttpServlet; import javax.s... 阅读全文