diff --git a/Capture 1.png b/Capture 1.png new file mode 100644 index 0000000..cce7450 Binary files /dev/null and b/Capture 1.png differ diff --git a/Questions.txt b/Questions.txt new file mode 100644 index 0000000..1a838a0 --- /dev/null +++ b/Questions.txt @@ -0,0 +1,40 @@ +Q) Which are legal: + +A) class X { + var x = 99; + } + +B) void doStuff(var x) { } + +C) void doStuff() { + var x; + x = 100; + } + +D) void doStuff() { + var x = 100; + } + +E) void doStuff() { + var x = null; + } + +Q) Which are legal: + +A) for (var x = 0; x < 3; x++) + System.out.println(x); + +B) try (var in = new FileReader(""); + var out = new FileWriter("")) { + } + +C) try (FileReader in = new FileReader("")) { + } catch (var ex) { } + +D) void doStuff() { + var x = new int[]{ 1, 2, 3 }; + } + +E) void doStuff() { + var x = { 1, 2, 3 }; + } \ No newline at end of file diff --git a/src/main/java/usingvar/Ex1.java b/src/main/java/usingvar/Ex1.java new file mode 100644 index 0000000..ec64691 --- /dev/null +++ b/src/main/java/usingvar/Ex1.java @@ -0,0 +1,48 @@ +package usingvar; + +//class X { +// var x = 99; +//} + +import java.io.FileReader; +import java.io.FileWriter; + +public class Ex1 { +// void doStuff(var x) { } +// void doStuff() { +// var x; +// x = 100; +// } +// void doStuff() { +// var x = 100; +// } +// void doStuff() { +// var x = null; +// } + + public static void main(String[] args) throws Throwable { +// for (var x = 0; x < 3; x++) +// System.out.println(x); + +// try (var in = new FileReader(""); +// var out = new FileWriter("")) { +// } + +// try (FileReader in = new FileReader("")) { +// } catch (var ex) { } + + } + +// void doStuff() { +// var x = new int[]{ 1, 2, 3 }; +// } + +// void doStuff() { +// var x = { 1, 2, 3 }; +// } + +// void showStuff(CharSequence [] csa) {} +// void useIt() { +// showStuff(new String[]{"a", "b"}); +// } +}