In this lesson, you'll learn about the structure
of a java program, how a program executes statements and how to
fix syntax errors check out the most common program below which only has a single class-main
We've added the main method public static void main() as the execution starting point of the program. Finally, we have added a println statement inside of the main method field. Now if you run your compiler it should print "java", we have added another printline statement that will run after the first one look at it in the main method field. each printline statement is executed and print a text in a line. now notice what happens if you remove the semi-colon at the end of the statement, guess what! you should see an error now on your compiler indicating by a red squiggly line. java program will only run if they contain no errors. Now add a third printline statement that will prints "Cool" below "java" and "is" then execute afterward.
The output should be 3 lines now. the words after the forward-slash (/) indicates a comment, it only contains explanation but is not executed.
of a java program, how a program executes statements and how to
fix syntax errors check out the most common program below which only has a single class-main
We've added the main method public static void main() as the execution starting point of the program. Finally, we have added a println statement inside of the main method field. Now if you run your compiler it should print "java", we have added another printline statement that will run after the first one look at it in the main method field. each printline statement is executed and print a text in a line. now notice what happens if you remove the semi-colon at the end of the statement, guess what! you should see an error now on your compiler indicating by a red squiggly line. java program will only run if they contain no errors. Now add a third printline statement that will prints "Cool" below "java" and "is" then execute afterward.
The output should be 3 lines now. the words after the forward-slash (/) indicates a comment, it only contains explanation but is not executed.
0 Comments