Run ❯
Get your
own Java
server
❯
Run Code
Ctrl+Alt+R
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Go to Spaces
Ctrl+Alt+P
class Box
{ T value; // T is a placeholder for any data type void set(T value) { this.value = value; } T get() { return value; } } public class Main { public static void main(String[] args) { // Create a Box to hold a String Box
stringBox = new Box<>(); stringBox.set("Hello"); System.out.println("Value: " + stringBox.get()); // Create a Box to hold an Integer Box
intBox = new Box<>(); intBox.set(50); System.out.println("Value: " + intBox.get()); } }
Value: Hello
Value: 50