preview

Math System Essay

Decent Essays

double[] mynewArray = {1.9, 2.9, 3.4, 3.5};

// Print all the array elements for (int i = 0; i <mynewArray.length; i++) { System.out.println(mynewArray[i] + " "); }

// Summing all elements double sum = 0; for (int i = 0; i <mynewArray.length; i++) { sum += mynewArray[i]; } System.out.println("Total is " + sum);

// Finding the largest element double largest = mynewArray[0]; for (int i = 1; i <mynewArray.length; i++) { if (mynewArray[i] > largest) largest = mynewArray[i]; } System.out.println("Max is " + largest); } }

Output:
1.9
2.9
3.4
3.5
Total is 11.7
Max is 3.5

OOPS Concepts
OOPs or Object- Oriented Programming is basically …show more content…

It is invoked when an object is created. It is defined on the name of class and does not have any explicit return type.
For Example: class Choco{ Choco(){System.out.println(" Choco is created");} public static void main(String args[]){ Choco b=new Choco(); } }
Output:
Bike is created

This Key Word

For refering current object, This keyword is used in JAVA. Following are some key uses of this keyword:

• To refer cvariable of current class instance
• To implicitly invoke method if current class
• this() can also be considered for invoking constructor of current class

Inheritance

Inheritance in java is a methodology in which one object gets every one of the properties and nature of parent object mainly used for Method overriding and code reusability.

Super Key Word

The super keyword is a reference variable mainly referring the immediate parent class object.

Polymorphism

The literal meaning of 'polymorphism' is 'a state of having many forms'. When applied to Java, it describes its method to process objects of various forms and classes through a single interface.

Abstraction

Abstraction in Java is used to show the

Get Access