上一页 1 ··· 8 9 10 11 12
摘要: 多线程中使用Runnable的接口与Thread类来实现,注意是Thread类不是其子类,关键是将Runnable接口作为参数进行传递 另外两个共同的类作为线程则成员变量是共享的。。。。指的是run以外的 Thread.currentThread()返回线程编号 Thread.currentThre 阅读全文
posted @ 2018-10-11 14:28 爱晒太阳的懒猫。。 阅读(126) 评论(0) 推荐(0)
摘要: 1.多线程并不是并行过程,而是一个使用中断之后另一个继续上,他们共同使用一个cpu资源 class SpeakElephant extends Thread{ public void run(){ for(int i=1;i<=5;i++){ System.out.println("其他线程:初音" 阅读全文
posted @ 2018-10-11 13:18 爱晒太阳的懒猫。。 阅读(103) 评论(0) 推荐(0)
摘要: import java.io.*;public class BRRead { public static void main(String args[]) throws IOException { char c; // 使用 System.in 创建 BufferedReader BufferedR 阅读全文
posted @ 2018-10-08 17:44 爱晒太阳的懒猫。。 阅读(138) 评论(0) 推荐(0)
摘要: class A{ void p(int[] a){ int i; for(i=0;i<6;i++){ System.out.println(a[i]); } } void q(String[] b){ int i; for(i=0;i<3;i++){ System.out.println(b[i]) 阅读全文
posted @ 2018-10-08 17:36 爱晒太阳的懒猫。。 阅读(1017) 评论(0) 推荐(0)
摘要: public class TestArray { public static void main(String arg[]){ int[] list = {1,2,3,4,5,6}; int[] lists = new int[3]; int i; lists[0] = 2; lists[1] = 阅读全文
posted @ 2018-10-08 17:09 爱晒太阳的懒猫。。 阅读(155) 评论(0) 推荐(0)
摘要: 1.类变量:独立于方法之外的变量,用 static 修饰。 2.实例变量:在类之内,在方法之外。(注意:这里变量可以不初始化) 3.局部变量:在方法之内(注意:变量必须要初始化,否则会报错) public class A() { static int a = 10;//类变量(静态变量) int b 阅读全文
posted @ 2018-10-08 16:37 爱晒太阳的懒猫。。 阅读(256) 评论(0) 推荐(0)
上一页 1 ··· 8 9 10 11 12