Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is a line in a Java program the same thing as a statement?

I'm a Java noob. I've only used it for a few days and I'm still trying to figure it all out. In a program, is a line the same thing as a statement?

like image 812
Benny Avatar asked Sep 18 '11 17:09

Benny


People also ask

What is difference between line and statement?

Line of code is basically how many end points you are using. A Statement is the group of code that you produce to create an expected output.

Is a line of code called a statement?

In computer programming, a statement is a single line of code that performs a specific task. For example, the following line of programming code from the Perl programming language is an example of a statement. $a = 3; In this example statement, a variable ($a) is assigned the value of "3" that is stored as a string.

What is an statement in Java?

Java statements are instructions that tell the programming language what to do, like declaration and string statements. Basic statements define variables and initiate Java methods or start the execution of blocks of other statements. Assignment statements assign values to variables.

What does line mean in programming?

In programming, a line is another name for a statement. 7. When referring to text, a line refers to one horizontal line of text.


1 Answers

No. I can write:

int x = 1; int y = 2;

That's one line, and two statements.

like image 183
Eric Avatar answered Sep 28 '22 20:09

Eric