This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ir.soheil_gh; | |
public class LocalVariableTypeInferenceExample1WithError { | |
public static void main(String[] args) { | |
var test; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ir.soheil_gh; | |
public class LocalVariableTypeInferenceExample2WithError { | |
public var test = "12"; | |
public static void main(String[] args) { | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ir.soheil_gh; | |
public class LocalVariableTypeInferenceExample3WithError { | |
public static void main(String[] args) { | |
var test = {1,2,3}; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ir.soheil_gh; | |
public class LocalVariableTypeInferenceExample4WithError { | |
public static void main(String[] args) { | |
var test = null; | |
} | |
} |