目录
我认为面试中可能会问到的,汇总一下。有些类名使用中文,为了方便查找的,实际项目开发中不会用中文类名的。
字符串是否相同比较
- 字符串是否相同比较
- 冒泡排序法
- 数组转置
- 多线程面试题
- 多线程加减
- 电脑生产与消费
- 竞拍抢答
public static void main(String args[]) {
String strA = "yootk" ; // 直接赋值实例化字符串对象
String strB = new String("yootk") ; // 构造方法进行实例化对象
String strC = strB ; // 引用传递(两个对象指向同一块堆内存)
System.out.println(strA.equals(strB)) ; // true
System.out.println(strA.equals(strC)) ; // true
System.out.println(strB.equals(strC)) ; // true
}
运行结果:
true
true
true
冒泡排序法
public class 数组的冒泡排序法 {
public static void main(String args[]) {
int data [] = new int [] {3, 1, 5, 2, 8, 6, 9, 0} ;
sort(data) ;
printArray(data) ;
}
public static void sort(int array[]) { // 进行数组排序操作
for (int x = 0 ; x
关注
打赏