Monday, 11 June 2018

Inheritance

Inheritance in Java In object-oriented programming, inheritance is the mechanism of basing an object or class upon another object  or class, retaining the same implementation. In most class-based object-oriented languages, an object created through inheritance (a "child object") acquires all the properties and behaviors of the parent object. Inheritance allows programmers to create classes that are built...

Friday, 8 June 2018

User input in Java

Scanner in Java There are various ways to read input from the keyboard, the java.util.Scanner class is one of them. The Java Scanner class breaks the input into tokens using a delimiter that is whitespace bydefault. It provides many methods to read and parse various primitive values. Java Scanner class is widely used to parse text for string and primitive types using regular expression. Java Scanner class extends Object...

Decision Making

Decision Making in Java Decision Making statements are piece of code which evaluates the program along with the statements to be executed and observes that the condition is true or false. if the condition is true the it executes the statement and vice-versa. Types of Decision Making statements :  if statement :- An if statement consists of a boolean expression followed by one or more statements. if...else...

Loops in Java

Loops In Java In Java, there may be requirement of the situation that you wants to execute a piece of code number of times, In that case loops may help you to handle the situation and run code multiple times. Types of loop in java:- do...while loopLike a while statement, except that it tests the condition at the end of the loop body. 2. while loopRepeats a statement or group of statements while a given condition is true....

Wednesday, 14 February 2018

Methods in Java

p { margin-bottom: 0.25cm; direction: ltr; line-height: 120%; text-align: left; } Methods A method is a set of code which is referred to by name and can be called (invoked) at any point in a program simply by utilizing the method’s name. Think of a method as a subprogram that acts on data and often returns a value. Each method has its own name. Types of Java Methods :- There are 2 types of methods: 1. Standard Library Methods 2....