JAVA笔试题(1)
来源:互联网 发布:下载pplive网络电视 编辑:程序博客网 时间:2024/06/11 00:04
1、判断对象类型的方法?
instanceof
2、根据程序写结果 (F:false,T:true)
public class Main { public static void main(String []args){ String a="str"+"ing"; String b="str".concat("ing"); String c=new String("string"); String d="string"; String e="str"; String g="ing"; String h=e+g;//创建了新对象 System.out.println("a==b: "+(a==b));//F System.out.println("a==c: "+(a==c));//F System.out.println("a==d: "+(a==d));//T System.out.println("a==h: "+(a==h));//F System.out.println("b==c: "+(b==c));//F System.out.println("b==d: "+(b==d));//F System.out.println("b==h: "+(b==h));//F System.out.println("c==d: "+(c==d));//F System.out.println("c==h: "+(c==h));//F System.out.println("d==h: "+(d==h));//F }}
3、ArrayList与Vector的区别?
1、Vector的方法是同步的,ArrayList不是同步的,后者性能比前者好
2、当元素超过初始大小时,Vector将其容量翻倍,而ArrayList只增加50%的容量。
4、实现StringUtil的isEmpty方法?
public static boolean isEmpty(CharSequence str) { if (str == null || str.length() == 0) return true; else return false; }
5、collection和collections区别?
Collection是一个集合接口。它提供了对集合对象进行基本操作的通用接口方法,其接口在类库中有很多具体的实现。
Collections是一个包装类。它包含有各种有关集合操作的静态多态方法。
0 0
- JAVA笔试题(1)
- java笔试题1
- JAVA笔试题1
- java笔试题1
- Java 笔试题(1)
- java笔试题(1)
- java笔试题1
- java 笔试题1
- Java笔试题1
- java笔试题1
- Java笔试题-1
- Java 笔试题1
- java基础笔试题(1)
- Java笔试题笔记(1)
- java笔试题及答案(1)
- java笔试题(1)基础知识
- (转)java笔试题1
- (转)java笔试题1
- Problem I: 大整数的加法运算
- 解释器模式
- H5全屏轮播图如何居中显示图片不拉伸
- 微信小程序关于函数调用的小坑
- 九度题目1087:约数的个数
- JAVA笔试题(1)
- 命令模式
- ubuntu如何通过蓝牙与手机连接上网
- gulp自动化管理精灵图
- samba问题总结windows客户端无法访问samba服务器,无法网络映射驱动器
- C# 使用WebAPI上传文件实现
- PySide+QWebView使用
- Mac版Intellij IDEA弹窗报this license XXXXXXXX has been cancelled
- Android Studio由于support版本冲突导致布局编辑器无法显示RecyclerView