What is the purpose of the 'super' keyword in Java?
Example:
Example:
class Subclass extends Superclass {
void display() {
super.display(); // calls the display method of the parent class
}
}
복습용 저장
복습용 저장
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
WithoutBook은 주제별 면접 질문, 온라인 연습 테스트, 튜토리얼, 비교 가이드를 하나의 반응형 학습 공간으로 제공합니다.
Know the top Java Support interview questions and answers for freshers and experienced candidates to prepare for job interviews.
Know the top Java Support interview questions and answers for freshers and experienced candidates to prepare for job interviews.
Search a question to view the answer.
Example:
Example:
class Subclass extends Superclass {
void display() {
super.display(); // calls the display method of the parent class
}
}
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Example:
Example:
public class MyClass {
int x;
void setX(int x) {
this.x = x; // sets the instance variable x
}
}
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Example:
Example:
class MathOperations {
int add(int a, int b) {
return a + b;
}
double add(double a, double b) {
return a + b;
}
}
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Example:
Example:
if (myObject instanceof MyClass) {
// do something
}
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Example:
Example:
for (int i = 0; i < 10; i++) {
if (i == 5) {
break; // exit the loop when i is 5
}
}
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Example:
Example:
String str = 'Hello';
str = str.concat(' World'); // creates a new String object
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Example:
Example:
double result = Math.sqrt(25.0); // calculates the square root
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Example:
No specific example, as the JVM itself is not directly programmable.
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Example:
Abstract class example:
abstract class Shape {
abstract void draw();
}
Interface example:
interface Shape {
void draw();
}
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Example:
Example:
class MyThread extends Thread {
public void run() {
// thread execution logic
}
}
MyThread t1 = new MyThread();
t1.start();
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Example:
Example:
try {
// code that may throw an exception
}
catch (Exception e) {
// handle the exception
}
finally {
// cleanup code
}
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Example:
Example:
class MyClass {
static int count;
static void incrementCount() {
count++;
}
}
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Example:
Example:
public final class ImmutableClass {
// class definition
}
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Example:
Example:
void myMethod() throws CustomException {
// method implementation
}
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Example:
Example:
class Animal {
void makeSound() {
System.out.println('Generic Animal Sound');
}
}
class Dog extends Animal {
void makeSound() {
System.out.println('Bark');
}
}
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Example:
It's important to ensure that the 'equals()' and 'hashCode()' methods are consistently implemented to maintain this contract.
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Example:
Example:
interface MyInterface {
default void myMethod() {
// default implementation
}
}
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Example:
Example:
class MyComparator implements Comparator{
public int compare(MyClass obj1, MyClass obj2) {
// custom comparison logic
}
}
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Example:
Example:
class Subclass extends Superclass {
Subclass() {
super(); // invokes the constructor of the parent class
}
}
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Example:
Example:
try (BufferedReader br = new BufferedReader(new FileReader('file.txt'))) {
// code that uses 'br'
} catch (IOException e) {
// handle the exception
}
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Example:
Example:
ListmyList = new ArrayList<>();
Collections.addAll(myList, 'Java', 'Python', 'C++');
Collections.sort(myList); // sorts the list
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Example:
Example:
final class ImmutableClass {
private final int value;
public ImmutableClass(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Example:
Example:
@Override
public boolean equals(Object obj) {
// custom implementation
}
@Override
public int hashCode() {
// custom implementation
}
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Example:
No specific example, as garbage collection is a background process handled by the JVM.
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Example:
Example:
class MyClass implements Serializable {
transient int sensitiveData;
}
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Example:
Example:
volatile boolean flag = true;
// variable shared among multiple threads
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Example:
Example:
int x = -1;
assert x >= 0 : 'x should be non-negative';
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Example:
Example:
java -cp myapp.jar com.example.MyClass
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Example:
Example:
double result = 0.0 / 0.0; // results in NaN
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
Example:
Example:
ExecutorService executor = Executors.newFixedThreadPool(5);
executor.submit(() -> System.out.println('Hello, concurrent world!'));
executor.shutdown();
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.