Differences between Java and JavaScript Programming languages PART 3: repeating and math
Math in Java Essentially the same Int vs double If there’s no decimal in the problem, there’s no decimal in the answer. Chop off (truncate any decimal part) Order of Operations Same as math (1+2) * 5 + 1 – 4 / 2 + 8 Please Excuse My Dear Aunt Sally. + add - subtract * multiply / divide % remainder after division
Modularization Javascript uses functions Java uses methods function myFunction ( ) { statements; } Java uses methods public void myFunction ( ) { statements; }
OOP Syntax (Object Oriented Programming) What is OOP? Java Defining objects: their properties and actions The syntax to invoke a method for an object is: objectName.method(parameters) Create an object: Circle c = new Circle(10); Call a method c.setColor(Color.red); You can define your own classes and methods.