This file contains hidden or 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
object Test { | |
def main(args : Array[String]){ | |
println("Hello world") | |
} | |
} |
This file contains hidden or 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
class HelloWorld { | |
def main(args : Array[String]){ | |
println("Hello world") | |
} | |
} |
This file contains hidden or 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
<data id="User"> | |
<Username>Username</Username> | |
<Password>Password</Password> | |
</data> |
This file contains hidden or 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
public class NaiveJavaExample { | |
public static void main(String[] args) { | |
System.out.println("Hello World!!"); | |
} | |
} |
This file contains hidden or 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
function readFromWebServiceAndParse($data){ | |
//Do something | |
//Return some value | |
} |
This file contains hidden or 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
def greater(a, b): | |
if a > b: | |
return "greater" | |
print(greater(10, 22)) |
This file contains hidden or 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
final ArrayList<Integer> arrList = new ArrayList<Integer>(); | |
//This does not result in error, we are mutating the object itself | |
//If it were mutable it would result in error to something like it cannot be changed | |
arrList.add(20); | |
//This results in error as we are modifying the reference and not the object itself | |
arrList = null; |
This file contains hidden or 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
class Test { | |
def main (args: Array[String]) { | |
var myVar = 10 | |
//Works fine | |
myVar = myVar + 10 | |
val myNum = 6 | |
//Will Result in compilation error | |
//Reassignment to val | |
myNum = myNum + 10 |
This file contains hidden or 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
val t = 69 | |
//Prints 'E' the ASCII value of E is 69 | |
println(t.toChar) | |
val s = "Hello World" | |
//Just like String char at, prints l | |
//Trace leads to the same String class charAt method | |
println(s.charAt(2)) |
This file contains hidden or 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
val x = 20 | |
//print to the console | |
//legit, gets inferred as an integer | |
println(x+10) | |
//Something stupid as below will throw compile time error | |
val z = 40 | |
println(z * "justastring") |
OlderNewer