What is the use of App class in Scala

0 votes

How App class can be used in Scala? Can anyone give an example an explain?

Jul 31, 2019 in Apache Spark by Rashmi
11,416 views

1 answer to this question.

0 votes

Hi,

Scala provides a helper class, called App, that provides the main method. Instead of writing your own main method, classes can extend the App class to produce concise and executable applications in Scala. 

Here is an example is shown:

object Main extends App {
  Console.println("Hello Scala: " + (args aString ", "))
}

Here, object Main inherits the main method of App trait and args returns the current command-line arguments as an array, similar to String[] args in Java main method.

Hope this helps!!

If you need to learn more about Scala, It's recommended to join Scala Certification course today.

Thank you!

answered Jul 31, 2019 by Gitika
• 65,770 points

Related Questions In Apache Spark

0 votes
1 answer

Which syntax to use to take the sum of list of collection in scala?

Hi, You can see this example to get ...READ MORE

answered Jul 5, 2019 in Apache Spark by Gitika
• 65,770 points
1,885 views
0 votes
1 answer

How to use yield keyword in scala and why it is used instead of println?

Hi, The yield keyword is used because the ...READ MORE

answered Jul 6, 2019 in Apache Spark by Gitika
• 65,770 points
1,932 views
–1 vote
0 answers
0 votes
1 answer

What is Case Class in Scala?

Hey, Scala case classes let us model immutable data. ...READ MORE

answered Jul 29, 2019 in Apache Spark by Gitika
• 65,770 points
977 views
+1 vote
2 answers
+1 vote
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 11,380 points
11,076 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 11,380 points
2,573 views
+2 votes
11 answers

hadoop fs -put command?

Hi, You can create one directory in HDFS ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points
109,071 views
0 votes
1 answer

What is the advantage of having immutability in design for Scala programming language?

Hi, Scala uses immutability by default in most ...READ MORE

answered Jul 24, 2019 in Apache Spark by Gitika
• 65,770 points
794 views
0 votes
1 answer

What is the work of Yield Keyword in Scala?

Hey, Used with a loop, yield produces a value for ...READ MORE

answered Jul 26, 2019 in Apache Spark by Gitika
• 65,770 points
963 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP