We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 6
structure in
Java programming • comments ( o) • Package Declaration (o) Parts of Java • Import statements (o)
Programming - • class Declaration (C)
9 • variable Declaration (O)
• constructor Implementation (O) • Method Implementation (C) • static blocks (O) • Non static blocks (O) Java supports 3 Types of comments single Line Multi line Documentation comment // comment /* */ comment /** */ comments are the statements that are ignored by compiler & interpreter • Why class ? Used to Provide Explanation about • why variable ? • why constructor ? • why Method ? • why and How logic is
written inside Method ?
other can understand Code by these comments
Single Line comment - // • To write class Name as a File Name
• in informal documentation to decsribe about the following class
Name,variable name, condcutor & Method Etc
• Inside Method to comment single liens such as var declaration, var
initilaization, object creation, method calling and return statements
Multi Line comment - // • use this to comment a block of code in the method such as conditions, loops, exception handling, -
old method implementations - /*
• example as follows :-
for(int i=o; i<20;i++){
/*
if (i%2==0){
system.out.printin("this is even number");
} else {
system.out.printin("this is odd number");
*/
var_oddOr$even=(i%2==0)?"This is even number ":"This is odd number";