Guys/Girls I am using Eclipse IDE for Scala for development
You can easily download this from below URL
http://scala-ide.org/download/current.html
Now lets start with our first example.As usual it Hello World program.
Please follow below steps to create and execute first class
1)GO to file =>New=>Select "Scala Class"
2)Give name as HelloWorld.scala
3) Inside Class use method println to write hello world.
code will look like
class HelloWorldWithObject {
println("Hello World");
}
4)We need to run this class ut we can not run this class without main method so we are going to create one object having name hello
code for object is
object hello {
def main(args: Array[String]): Unit = {
var name = new HelloWorldWithObject();
}
}
5)The complete class will look like
package com.sagar.basic
class HelloWorldWithObject {
println("Hello World");
}
object hello {
def main(args: Array[String]): Unit = {
var name = new HelloWorldWithObject();
}
}
7)Right click inside class and run it as scala application
it will print below output:
Hello World
You can easily download this from below URL
http://scala-ide.org/download/current.html
Now lets start with our first example.As usual it Hello World program.
Please follow below steps to create and execute first class
1)GO to file =>New=>Select "Scala Class"
2)Give name as HelloWorld.scala
3) Inside Class use method println to write hello world.
code will look like
class HelloWorldWithObject {
println("Hello World");
}
4)We need to run this class ut we can not run this class without main method so we are going to create one object having name hello
code for object is
object hello {
def main(args: Array[String]): Unit = {
var name = new HelloWorldWithObject();
}
}
5)The complete class will look like
package com.sagar.basic
class HelloWorldWithObject {
println("Hello World");
}
object hello {
def main(args: Array[String]): Unit = {
var name = new HelloWorldWithObject();
}
}
7)Right click inside class and run it as scala application
it will print below output:
Hello World
No comments:
Post a Comment