A statement is a command given by the programmer to the computer program. Statements are used by different computer programming languages, such as Java, C, and C++. The syntax for declaring and using statements varies in each language. A simple example of a statement can be:
println “Hello ! I hope you are enjoying your stay here”
The statement uses a set of words “Hello! I hope you are enjoying your stay here?” and other details, such as what will be printed on screen. The command println tells the computer to show the output on the monitor and not on the printer. The computer understands this command in the following two ways:
The programmer can give the command to the computer in the running mode, as the program is being executed.
They can also store a statement or a set of statements in a text file and execute it as and when required. This will then save the task of executing the statements again and again. For example, the command we just saw can be saved in a file Hello.txt and give this file to the computer.
As stated above, you can also save a set of multiple statements in a text file, which will then be executed in the top to bottom order. This means that the statement on the top will be executed first, followed by all other statements in that order.
Continue reading JAVA – Different type of Statements