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
1,567 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.

answered Jul 31, 2019 by Gitika
• 33,110 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
• 33,110 points
233 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 5, 2019 in Apache Spark by Gitika
• 33,110 points
179 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
• 33,110 points
103 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
• 10,920 points
5,446 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
• 10,920 points
803 views
+1 vote
11 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyF ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
33,716 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
• 33,110 points
77 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
• 33,110 points
116 views