First of all the main question arises about the statements that is "What is a statements in a program ".
The answer is "It is smallest unit of a program that is a complete instruction in itself. " Statements of java generally contain expressions a end with a semi-colon (;). The two most commonly used statements in any programming language are as follows:
Sequential statements : These are the statements which are executed one by one .
Control statements : These are the statements that are executed randomly and repeatedly .
These are followed by java also.
Now lets assume an example :
System.out.println("Hello Jarvis");
a=b+c;
System.out.println("a");
So what you think , what type of statement it is
I tell you that is the example of Sequential statements as you can see that the execution of statements are in sequence .
What is control statements?
Control statements are the statements which alter the flow of execution and provide better control to the programmer on the flow of execution . They are useful to write better and complex programs.
These are the following control statements are available in java:
The answer is "It is smallest unit of a program that is a complete instruction in itself. " Statements of java generally contain expressions a end with a semi-colon (;). The two most commonly used statements in any programming language are as follows:
Sequential statements : These are the statements which are executed one by one .
Control statements : These are the statements that are executed randomly and repeatedly .
These are followed by java also.
Now lets assume an example :
System.out.println("Hello Jarvis");
a=b+c;
System.out.println("a");
So what you think , what type of statement it is
I tell you that is the example of Sequential statements as you can see that the execution of statements are in sequence .
What is control statements?
Control statements are the statements which alter the flow of execution and provide better control to the programmer on the flow of execution . They are useful to write better and complex programs.
These are the following control statements are available in java:
- if-else statement
- do-while loop
- while loop
- for loop
- for-each loop
- switch statement
- break statement
- continue statement
- return statement
No comments:
Post a Comment