View LocalVariableTypeInferenceExample4WithError.java
package ir.soheil_gh; | |
public class LocalVariableTypeInferenceExample4WithError { | |
public static void main(String[] args) { | |
var test = null; | |
} | |
} |
View LocalVariableTypeInferenceExample3WithError.java
package ir.soheil_gh; | |
public class LocalVariableTypeInferenceExample3WithError { | |
public static void main(String[] args) { | |
var test = {1,2,3}; | |
} | |
} |
View LocalVariableTypeInferenceExample2WithError.java
package ir.soheil_gh; | |
public class LocalVariableTypeInferenceExample2WithError { | |
public var test = "12"; | |
public static void main(String[] args) { | |
} | |
} |
View LocalVariableTypeInferenceExample1WithError.java
package ir.soheil_gh; | |
public class LocalVariableTypeInferenceExample1WithError { | |
public static void main(String[] args) { | |
var test; | |
} | |
} |
View LocalVariableTypeInferenceExample.java
package ir.soheil_gh; | |
import java.util.HashMap; | |
public class LocalVariableTypeInferenceExample { | |
public static void main(String[] args) { | |
var test = "soheil"; | |
System.out.println(test.getClass().getCanonicalName()); | |
var test2 = 2*2; // test2 is int |
View ParameterPassingTest.java
package ir.soheil_gh; | |
public class ParameterPassingTest { | |
public static void main(String[] args) { | |
int a = 10; | |
System.out.println("value of a before calling change method: " + a); | |
change(a); | |
System.out.println("value of a after calling change method: " + a); |
View StringTest.java
package ir.soheil_gh; | |
public class StringTest { | |
public static void main(String[] args) { | |
long t1 = System.currentTimeMillis(); | |
String initialString = ""; | |
for(int i=0; i<50000; i++ ){ | |
initialString += i; | |
} |