2、写出以下代码执行结果,分析为什么?(没有分析结果不得分)
温馨提示:①需要有思路;②需要加注释;③需要有运行结果
public class Test {
public static void main(String[] args) {
String s = "abc";
s.substring(1);
s.replace("bc", "xyz");
System.out.println(s);
String value = new String ("abc");
System.out.println(s == value);
}
}
3、编写程序,将指定目录下所有.java文件拷贝到另一个目的中,并将扩展名改为.txt
3、写一个买票的程序。
① 写一个类,该类实现了Runnable接口。有一个私有类型的int型的参数:
tickets.票的总数,为100,完成run方法,输出结果的格式如下:
当前窗口为:Thread-2,剩余的票数为:19,其中Thread-2为线程的名称。
② 开启四个买票窗口(起四个线程),同时执行买票的程序。