Add fresher-qa module: 50 Java interview questions for freshers, one runnable demo each, asserted transcripts, javac error captures
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b5DfjBGLBr7F5km2AN
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
class CheckedNotHandled {
|
||||
public static void main(String[] args) {
|
||||
String s = Files.readString(Path.of("missing.txt"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class Base {
|
||||
final String locked() { return "Base.locked"; }
|
||||
}
|
||||
|
||||
class Derived extends Base {
|
||||
String locked() { return "Derived.locked"; }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
class LossyCast {
|
||||
public static void main(String[] args) {
|
||||
int x = 3.5;
|
||||
byte b = 200;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class MissingReturnAndUnreachable {
|
||||
static int sign(int n) {
|
||||
if (n > 0) return 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class Animal {
|
||||
Animal() { }
|
||||
}
|
||||
|
||||
class Puppy extends Animal {
|
||||
Puppy(String name) {
|
||||
if (name.isBlank()) throw new IllegalArgumentException("name required");
|
||||
super();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user