1. 首页
  2. 数据库
  3. 其它
  4. java中String类的笔试面试题含答案

java中String类的笔试面试题含答案

上传者: 2020-12-22 13:23:38上传 PDF文件 89.85KB 热度 17次
java中String类的笔试面试题含答案 1.下面程序的运行结果是()(选择一项) String str1=”hello”; String str2=new String(“hello”); System.out.println(str1==str2); A. true B. false C. hello D. he 答案:B 分析:str1没有使用new关键字,在堆中没有开辟空间,其值”hello”在常量池中,str2使用new关键字创建了一个对象,在堆中开辟了空间,”==”比较的是对象的引用,即内存地址,所以str1与str2两个对象的内存地址是不相同的 2.Java语言中,Strin
下载地址
用户评论