Learn how to translate a simple Java program into the Scala language framework.
- [Instructor] Welcome to your first challenge.…In this challenge, I'm going to give you…a sample Java program, and you're going to…translate that to Scala.…The program is a simple calculator program,…that allows the user to do addition, division,…multiplication and subtraction.…You can choose to either use the Scala IDE…or you can use a text editor,…and then use the Scala interpreter…to compile and run your program.…Let's take a quick look at the Java code.…It starts out with public class calculator,…and it has one main method;…public static void main,…which has a string array of arguments.…
It has two variables that are both integers, X and Y,…and they each have an initial value…of 10 and five, respectively.…Then I use a print line statement to print out…the result of calling the addition method,…the quotient method, the times method,…and the minus method.…That ends the main method;…you see the close curly bracket there,…and below that I define each of the static methods.…So we have public static int addition,…
- Installing Scala
- Integrating with IDEs
- Creating variables
- Using special functions
- Basic types and operations
- Tuples, sets, maps, arrays, and lists
- Classes, fields, and methods
- Singleton objects
Skill Level Intermediate
1. Why Scala?
2. Scala Basics
3. More Scala Basics
4. Objects with Scala
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.