Skip to content

Instantly share code, notes, and snippets.

View techindepth's full-sized avatar
👋

ANISH ANTONY techindepth

👋
View GitHub Profile
rbo = new ReallyBigObject();
// more code here
rbo = null;
/* insert code here */
public class GC {
private Object o;
private void doSomethingElse(Object obj) {
o = obj;
}
public void doSomething() {
Object o = new Object();
doSomethingElse(o);
public class Test {
public static void main(String[] args) {
Short s = 15;
Boolean b;
// insert code here
}
}
public class Test {
public static void main(String[] args) {
Integer i = 42;
String s = (i < 40) ? "life" : (i > 50) ? "universe" : "everything";
System.out.println(s);
}
}
public class Test {
public static void main(String[] args) {
Test t = new Test();
t.getValue();
}
public int getValue() {
int value = 0;
boolean setting = true;
String title = "Hello";
public class Test {
public static void main(String[] args) {
int x = 5;
Test t = new Test();
t.doStuff(x);
System.out.print(" main x = " + x);
}
void doStuff(int x) {
System.out.print(" doStuff x = " + x++);
public class Test {
void doStuff(int x) {
System.out.print(" doStuff x = " + x++);
}
public void main(String[] args) {
int x = 6;
Test p = new Test();
p.doStuff(x);
System.out.print(" main x = " + x);
package com.ocjp;
public class Test {
public static void main(String[] args) {
int x = 5;
boolean b1 = true;
boolean b2 = false;
if ((x == 4) && !b2)
System.out.print("1 ");
public class IOTest {
public static void main(String[] args) {
SpecialSerial s = new SpecialSerial();
try {
ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream("myFile"));
os.writeObject(s);
os.close();
System.out.print(++s.z + " ");
ObjectInputStream is = new ObjectInputStream(new FileInputStream("myFile"));
SpecialSerial s2 = (SpecialSerial) is.readObject();
public class IOTest {
static String[] dirs = { "dir1", "dir2" };
public static void main(String[] args) {
for (String d : dirs) {
// insert code 1 here
File file = new File(path, args[0]);
// insert code 2 here
}
}