Skip to content

Instantly share code, notes, and snippets.

View techindepth's full-sized avatar
👋

ANISH ANTONY techindepth

👋
View GitHub Profile
public class Test {
static void test() throws RuntimeException {
try {
System.out.print("test ");
throw new RuntimeException();
} catch (Exception ex) {
System.out.print("exception ");
}
}
public class Test {
public static void main(String[] args) {
try {
args = null;
args[0] = "test";
System.out.println(args[0]);
} catch (Exception ex) {
System.out.println("Exception");
} catch (NullPointerException npe) {
System.out.println("NullPointerException");
public class Test {
public static void main(String[] args) {
Float pi = new Float(3.14f);
if (pi > 3) {
System.out.print("pi is bigger than 3. ");
}
else {
System.out.print("pi is not bigger than 3. ");
}
finally {
public class Test {
static void test() throws Error {
if (true)
throw new AssertionError();
System.out.print("test ");
}
public static void main(String[] args) {
try {
test();
class A {
public void process() {
System.out.print("A,");
}
}
public class Test extends A {
public void process() throws IOException {
super.process();
System.out.print("B,");
//some code
try {
// some code here
} catch (SomeException se) {
// some code here
} finally {
// some code here
}
try {
ResourceConnection con = resourceFactory.getConnection();
Results r = con.query("GET INFO FROM CUSTOMER");
info = r.getData();
con.close();
} catch (ResourceException re) {
errorLog.write(re.getMessage());
}
return info;
public class Test {
public static void parse(String str) {
try {
float f = Float.parseFloat(str);
} catch (NumberFormatException nfe) {
f = 0;
} finally {
System.out.println(f);
}
}
public class GC {
public static void main(String[] args) {
GC e1 = new GC();
GC e2 = new GC();
GC e3 = new GC();
e3.e = e2;
e1.e = e3;
e2 = null;
e3 = null;
e2.e = e1;
public class GC {
Short story = 5;
GC go(GC cb) {
cb = null;
return cb;
}
public static void main(String[] args) {
GC c1 = new GC();