- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 10102 Articles for Object Oriented Programming

307 Views
An if statement can be followed by an optional else if...else statement, which is very useful to test various conditions using single if...else if statement.When using if, else if, else statements there are a few points to keep in mind.An if can have zero or one else's and it must come after any else if's.An if can have zero to many else if's and they must come before the else.Once an else if succeeds, none of the remaining else if's or else's will be tested.Syntaxif(Boolean_expression 1) { // Executes when the Boolean expression 1 is true }else if(Boolean_expression 2) ... Read More

156 Views
It is always legal to nest if-else statements which means you can use one if or else if statement inside another if or else if statement.Syntaxif(Boolean_expression 1) { // Executes when the Boolean expression 1 is true if(Boolean_expression 2) { // Executes when the Boolean expression 2 is true } }Exampleclass Test { public static void main(String args[]) { int x = 30; int y = 10; if( x == 30 ) { if( y == 10 ) { System.out.print("X = 30 and Y = 10"); } } } }OutputX = 30 and Y = 10

117 Views
An if statement can be followed by an optional else statement, which executes when the Boolean expression is false.Syntaxif(Boolean_expression) { // Executes when the Boolean expression is true }else { // Executes when the Boolean expression is false }If the boolean expression evaluates to true, then the if the block of code will be executed, otherwise else block of code will be executed.Examplepublic class Test { public static void main(String args[]) { int x = 30; if( x < 20 ) { System.out.print("This is if statement"); }else { System.out.print("This is else statement"); } } }OutputThis is else statement

110 Views
An if statement consists of a Boolean expression followed by one or more statements.SyntaxFollowing is the syntax of an if statement −if(Boolean_expression) { // Statements will execute if the Boolean expression is true }If the Boolean expression evaluates to true, then the block of code inside the if statement will be executed. If not, the first set of code after the end of the if statement (after the closing curly brace) will be executed.Examplepublic class Test { public static void main(String args[]) { int x = 10; if( x < 20 ) { System.out.print("This is if statement"); } } }OutputThis is if statement.

91 Views
A for loop is a repetition control structure that allows you to efficiently write a loop that needs to be executed a specific number of times.A for loop is useful when you know how many times a task is to be repeated.SyntaxThe syntax of a for loop is:for(initialization; Boolean_expression; update) { // Statements }Here is the flow of control in a for loop −The initialization step is executed first, and only once. This step allows you to declare and initialize any loop control variables and this step ends with a semicolon (;).Next, the Boolean expression is evaluated. If it is ... Read More

115 Views
A do...while loop is similar to a while loop, except that a do...while loop is guaranteed to execute at least one time.SyntaxFollowing is the syntax of a do...while loop −do { // Statements }while(Boolean_expression);Notice that the Boolean expression appears at the end of the loop, so the statements in the loop execute once before the Boolean is tested.If the Boolean expression is true, the control jumps back up to do statement, and the statements in the loop execute again. This process repeats until the Boolean expression is false.Examplepublic class Test { public static void main(String args[]) { ... Read More

165 Views
A while loop statement in Java programming language repeatedly executes a target statement as long as a given condition is true.SyntaxThe syntax of a while loop is −while(Boolean_expression) { // Statements }Here, statement(s) may be a single statement or a block of statements. The condition may be any expression, and true is any non-zero value.When executing, if the boolean_expression result is true, then the actions inside the loop will be executed. This will continue as long as the expression result is true.When the condition becomes false, program control passes to the line immediately following the loop.Here, the key point of ... Read More

451 Views
JavaScriptJavaScript is a dynamic computer programming language. It is lightweight and most commonly used as a part of web pages, whose implementations allow a client-side script to interact with the user and make dynamic pages.JavaScript do not create stand-alone applications. JavaScript is implemented using JavaScript statements that are placed within the ... .JavaJava programming language was originally developed by Sun Microsystems which was initiated by James Gosling and released in 1995 as a core component of Sun Microsystems' Java platform (Java 1.0 [J2SE]).Here are the differences:The JavaScript programming language is developed by Netscape, Inc and not part of the Java ... Read More

817 Views
>> Binary Right ShiftThe left operand value is moved right by the number of bits specified by the right operand.>>> Shift right zero fillThe left operand value is moved right by the number of bits specified by the right operand and shifted values are filled up with zeros.

4K+ Views
This article will help you understand what a dot operator in Java Programming language is. Before jumping into Dot Operator, let us revise about Operators. OPERATORS In computer programming we often need to perform some arithmetical or logical operations. In such circumstances, we need operators to perform these tasks. Thus, an Operator is basically a symbol or token, which performs arithmetical or logical operations and gives us meaningful result. The values involved in the operation are called Operands. Here is a basic Pictorial representation of Operators. Now, let us discuss the types of Operators available. TYPES OF OPERATORS There ... Read More