人気の面接質問と回答・オンラインテスト
面接対策、オンラインテスト、チュートリアル、ライブ練習のための学習プラットフォーム

集中型学習パス、模擬テスト、面接向けコンテンツでスキルを伸ばしましょう。

WithoutBook は、分野別の面接質問、オンライン練習テスト、チュートリアル、比較ガイドをひとつのレスポンシブな学習空間にまとめています。

面接準備

Core Java 面接の質問と回答

Test your skills through the online practice test: Core Java Quiz Online Practice Test

質問 1. What is Constructor in Java?

Constructor is a block of code which is executed at the time of Object creation. It is entirely different than methods. It has same name of class name and it cannot have any return type.

役に立ちましたか? コメントを追加 コメントを見る
 

質問 2. What is java.util package in Core Java?

Java.util package contains the collections framework, legacy collection classes, event model, date and time facilities, internationalization, and miscellaneous utility classes.

E.g.
  • java.util.List
  • java.util.Set
  • java.util.Date

役に立ちましたか? コメントを追加 コメントを見る
 

質問 3. What is difference between String and StringTokenizer?

A StringTokenizer is utility class used to break up string. Example:

StringTokenizer st = new StringTokenizer("Hello World");
while (st.hasMoreTokens()) {
	System.out.println(st.nextToken());
}
Output:
Hello
World

役に立ちましたか? コメントを追加 コメントを見る
 

質問 4. What is the argument type of a program's main() method?

A program's main() method takes an argument of the String[] type.

public static void main(String args[])
{
	System.out.println("WithoutBook");
}

役に立ちましたか? コメントを追加 コメントを見る
 

質問 5. What is this() keyword in core java and when should we use this() in core java?

The this keyword is primarily used in three situations. The first and most common is in setter methods to disambiguate variable references. The second is when there is a need to pass the current class instance as an argument to a method of another object. The third is as a way to call alternate constructors from within a constructor.

Example of Case 1: Using this to disambiguate variable references. In Java setter methods, we commonly pass in an argument with the same name as the private member variable we are attempting to set. We then assign the argument x to this.x.
public class Foo {
    private String name;
    // ...
    public void setName(String name) {
        // This makes it clear that you are assigning 
        // the value of the parameter "name" to the 
        // instance variable "name".
        this.name = name;
    }
    // ...
}
Example of Case 2: Using this we can pass current class object through method argument to another object.
class Foo{
	void callMethod(){
		Toy toy = new Toy();
		toy.insertValue(this); //Here this means Foo current object
	}
}
Example of Case 3: Using this to call alternate constructors. In the comments, trinithis correctly pointed out another common use of this. When you have multiple constructors for a single class, you can use this(arg0, arg1, ...) to call another constructor of your choosing, provided you do so in the first line of your constructor.
class Foo {
    public Foo() {
        this("Some default value for bar");
        // Additional code here will be executed 
        // after the other constructor is done.
    }
    public Foo(String bar) {
        // Do something with bar
    }
    // ...
}

役に立ちましたか? コメントを追加 コメントを見る
 

ユーザー評価で最も役立つ内容:

著作権 © 2026、WithoutBook。