分享一套JAVA英文笔试题(一)

1.What is the output of the following code?

 

public class TestEquals{
    public static void main(String[] args){
        String str1 = "test";
        String str2 = new String("test");
        String str3 = "test";
        System.out.println(str1 == str2);
        System.out.println(str1 == str3);
        System.out.println(str1.equals(str2));
        System.out.println(str1.equals(str3));
    }
}

 

 

2.Equals hash codes imply that the objects are equals.True or False?

 

3.What is the size of the character data type in bytes?

 

4.Check the following code

 

class A {
    public void doSomething(){}
}
class B extends A {
    private void doSomething(){}

}

a.Is it an example of method overloading OR method overriding?

 

b.Will the program throw compilation error,runtime error OR compile and run without any errors?

 

5.Check the following code

 

class C {
    private void doSomething(){}
}
public class D extends C {
    public void doSomething(){}
}

a.Is it an example of method overloading OR method overriding?

 

b.Will the program throw compilation error,runtime error OR compile and run without any errors?

 

6.Let us assume you only have a single user-defind public java class,the java compiler and java interpreter with you.It does not have a public static void main() method.Is it possible to execute any random code of your choice in such a java class?

 

For this question,you are NOT supposed to use any other API class or user-defined class.if you think it is possible,please write the code of the single class.if you think otherwise,please explain why it is not possible to execute code in such a class.

 

7.Can an abstract class have a "public static void main(String[] args)" method?

 

8.Check the following code

interface SuperInterface {
    void walk();
}
interface SubInterface implements SuperInterface {
    void run();
}
public class TsetInterface implements SubInterface {
   @Override
    public void walk(){
        System.out.println("I am walking");
    }
   @Override
    public void run(){
        System.out.println("I am running");
    }
    public static void main(String[] args) {
         TestInterface ti = new TestInterface();
         ti.walk();
         ti.run();
    }
}

 Which of the following is correct?

a Code throws compilation error

b Code throws run-time error

c Code runs fine and output is:

I am walking

I am running

 

9.When calling the main() method of a java class,if we do not provide any arguments on the command line,then the string array of main() method-will it be empty or null?

 

10.When differentiating overloaded methods does the compiler consider the return type of the method?

 

11.Can we override an overloaded method?

 

12.Can you overload the "public static void main(String[] args)" method in java?

 

13.Can you override a static or final method in java?

 

14.Can you declare a constructor as final in java?

 

15.Is java pass-by-value Or pass-by-reference?

 

16.Can an interface implement another classes?

 

17.Which object oriented concept is achieved by using overloading and overriding?

 

18.Which class is extended by all other classes?

 

19.Can a transient variable be serialized?

 

20.Is the String class declared final?

 

21.When does the garbage collector call the finalize() method?

 

22.Write the signature of the finalize() method?

 

23.Object E has reference to object F and object F has reference to object E.There are no other references to objects E and F.Select the correct answer.

a. No objects will be garbage collected as E has reference to F and F has reference to E.

b. Only object E will be garbage collected

c. Only object F will be garbage collected

d. Both objects E and F will be garbage collected

 

24.Can we call the garbage collector from java code?if yes,how?if no,why not?

 

25.Can we force garbage collector to run?

 

26.How can you monitor garbage collection?

 

27.Can you change values of an immutable object?

 

28.List the different access specifiers

 

 

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
米哈游Java后端笔试真题是面向Java后端开发岗位的一套笔试题目,旨在考察应聘者对Java后端开发的理解和应用能力。 这套笔试题目往往包含以下几个方面的内容: 1. Java语言基础:主要考察Java的基本语法、面向对象编程、常用类库等方面的知识。例如,常见的有关Java语言基础的题目有:反射机制的理解和应用、线程的创建和使用、异常处理等。 2. 数据库相关知识:主要考察应聘者对数据库的基本理解和SQL的使用能力。例如,常见的数据库相关题目有:数据库事务的概念和应用、数据库索引的优化策略、SQL语句的编写和调优等。 3. Web开发框架:主要考察应聘者对常用的Web开发框架的理解和应用能力。例如,常见的Web开发框架题目有:Spring框架的注解使用、MyBatis的配置和映射关系等。 4. 系统设计和优化:主要考察应聘者对大型系统设计和性能优化的能力。例如,常见的系统设计和优化题目有:数据库连接池的设计和实现、分布式系统的负载均衡策略、系统性能调优等。 总的来说,米哈游Java后端笔试真题是一套综合考察Java后端开发能力的题目,内容涵盖了Java语言基础、数据库相关知识、Web开发框架以及系统设计和优化等方面。应聘者需要具备扎实的Java编程基础,熟悉常用的开发框架和工具,以及对大型系统的设计和性能优化有一定的了解。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值