Friday, 30 May 2014

Return Statement In Java

Return statementThe return statement is used to explicitly return from a method.That is it transfer the control to the caller of method.And most important , return statement is always be the last statement of the current block. Simple Program for Return statement:package org.modi; public class Test { public static void main(String[] args) { System.out.println("Main method begin"); ...

Continue Statement In Java

Continue StatementThe continue statement is used to continue the execution of loop.In while and do-while loops , a continue statement transfer control to the conditional expression that controls the loop.In for loop , first control goes to the increment/decrements portion and the goes to the expression. Simple Program for Continue Statementpackage org.modi; public class Test { public static void...

Break Statement in Java

Break StatementIn java , the break statement has three uses.1. It terminates a statements sequence in switch statement.2. It can be used to exit a loop.3. It can be used as a "civilized" form of goto. The first use we had seen in swtich statement's post.And last two uses are explained here. 2. Using the break to exit loop:By break  , you can force to terminates the loop.When a break statement...

Thursday, 29 May 2014

Break And Continue in C

Break: The break statement allows you to exit a loop from any point within its body, bypassing its normal termination expression. When the break statement is encountered inside a loop, the loop is immediately terminated, and program control resumes at the next statement following the loop. The...

Goto Statement in C

10:53 Posted by Hindustan News , , No comments
In C programming, goto statement is used for altering the normal sequence of program execution by transferring control to some other part of the program. Syntax: goto label; ............. ............. ............. label: statement; }  When, the control of program reaches to goto statement,...

Switch-Case Statement in C

While if is good for choosing between two alternatives, it quickly becomes typical when several alternatives are needed. C's solution to this problem is the switch statement. The switch statement is C's multiple selection statement. It is used to select one of several alternative paths in program execution and works like this: A variable is successively tested against a list of integer or character...

if...else Statement in C

The if, if...else and nested if...else statement are used to make one-time decisions in C Programming, that is, to execute some code/s and ignore some code/s depending upon the test expression. Simple  if statement We often need to be able to choose which set of instructions are obeyed according to a condition. For example, if you're keeping a total(sum) and you need to display the message...

Decision Making In C

Decision making is about deciding the order of execution of statements based on certain conditions or repeat a group of statements until certain specified conditions are met. C language handles decision-making by supporting the following statements, if and else statement for loop do-while loop break and continue switch-case statement goto statement This also we known as control statement.It...

Tuesday, 27 May 2014

Switch In Java

The switch statement in  Java is used to execute the code from multiple conditions. It provides an easy way to dispatch execution to different parts of code based on the value of expression.It is a better alternative than a large series of if-else-if statements. The syntax of switch statement...

Friday, 23 May 2014

Java Control Statements

In this post we are going to discuss the control statements. The control statements are used to control the flow of execution of the program. Different type of control statements are: 1. Selection statements. 2. Iteration or looping statements. 3. Jump statements. 1.Selection statements:  Java supports two selection statements if and switch. These  statements allows you to control the...