Posts

Print in java | System.out.println in java

Image
How to print in java :-  We use System.out.println() in java to print the statements on to the console. Lets not worry about the System.out for now will explain it later.  There are three methods used to print something on to the console. They are print() println() printf() Print in java Lets discuss the 3 listed one by one :- print() :-  This method is used to print some text on to the console in java. print() method is the overloaded method of the printStream class. When the string or text is printed on to the console the cursor remains on the same line which means that if we print another text than the text will print on the same line of the previos print. Example :- System.out.print("Hello World!"); println() :- This method is an enhanced version of print() method which is also used to print the some text on to the console and it is a overloaded method of the printStream class. When the string or text is displayed on to the screen than the cursor moves on to the next...

BASIC STRUCTURE OF A JAVA PROGRAM

Image
  In this post you will learn the basic structure of a java program and what each line in that structure means Below is the photo of basic structure of a java program 1.Documentation Section :  It contains comments that increase the program's readability. A comment is a non-executable statement that aids in the reading and understanding of a program, particularly as it becomes more sophisticated. It's just a message that only the programmer sees, and the compiler ignores it. A good program should include comments that indicate the program's objective, author name, and creation date and time. Comments may appear anywhere in the program, and this area is optional. Now lets see the type of comments we can use in java programming,three different sorts of comments are supported by the Java programming language. i.Single Line Comment : It begins with a double slash symbol (//) and ends with the current line's end.  Everything from / to the end of the line is ignored by the co...