★ Differentiate between break and continue ( 2 main points )
★ Differentiate between method signature and method prototype
★ Short note on access specifier
★ What are arguments ?
Answers
The break statement terminates the whole iteration of a loop whereas continue skips the current iteration. The break statement terminates the whole loop early whereas the continue brings the next iteration early.
Technically, in Java, a method signature consists only of the name of the method and the parameter types and their order. Correct. And there's no such thing as a method prototype in Java. In C we know about prototypes and the same i Java Interface we have a similar thing.
Question 1:-
____________________
DIFFERENTIATE BETWEEN BREAK AND CONTINUE
Break Statement:-
- This method take control over the loop unconditionally i.e. when a break statement is encountered the control will break out of the loop to the next statement following the same loop.
- Example which will make better understanding
int a;
for( a=1 ; a < 10 ; a++ )
{
if (n==5)
{
System.out . println ( " loop is so");
break;
}
System . out . println (n+ ",");
}
System . out . println (" out of loop");
____________________________
Output:-
1,2,3,4 loop is so
Out of loop
______________________
Explanation:-
In the còde the loop will execute till the condition ( n<=10) but loop will end when n will be not equal to 5 due to break statement.
3. The loop will not depend on the condition to become false,it a break statement is used.
Continue statement:-
- This statement is used in any of the looping control structure.
- It cause loop to immediate jump to next iteration of loop.
- In a while loop and do-while loop update statement is always written before continue statement.
Question 2
_________________________________
Method signature:-
- The mostly contains name of the parament .
- In parament its type,order.
- public static void main is a example of it.
Method pròtotype:-
- protòtypes are the same in Java Interface protòtype have a similar thing and function.
____________________________________
Question 3
__________________________________
Short note on Access specifier
Access specifies accessibility or scope of a field, method, constructor, or class.There are four types of Java access modifiers . Default, Public, Protected and Private Access Modifiers.
_________________________________
Question 4
______________________________
Arguments are the kind of sentences that can be true or false. When someone is trying to persuade you to believe something, they will express this as a statement.
_____________________________