Skip to content

Instantly share code, notes, and snippets.

@minte9
Last active August 31, 2021 12:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save minte9/3355818fac7c7492c49d40f841afaca0 to your computer and use it in GitHub Desktop.
Save minte9/3355818fac7c7492c49d40f841afaca0 to your computer and use it in GitHub Desktop.
/**
* This code will throw an Exception Error
* Correct the error line
*/
class App {
public static void main(String[] args) {
/**
* SOLUTION
*/
Box<Integer> box = new Box<Integer>();
box.set(10);
System.out.println(box.get()); // 10
}
static class Box<T> {
private T t;
public void set(T t) { this.t = t; }
public T get() { return t; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment