- Keep the logic of the program "Simple".
- Before you write down the program or a section of a huge code always "visualize" your output.
- Start "Indenting" your programs.
by means of which you shall never forget your closing brace or any other brace.It will also help you to understand your program better.
eg:
Without Indentation
class Demo
{
public static void main(String args[])
{
int x=0;
if(x>0)
{
System.out.println("Hello World");
}
else
{
System.out.println("This is a demo program");
System.out.println("Hello World");
}
}
}
With Indentation
class Demo
{
public static void main(String args[])
{
int x=0;
if(x>0)
{
System.out.println("Hello World");
}
else
{
System.out.println("This is a demo program");
System.out.println("Hello World");
}
}
}
I think you all must have understood what I mean by indentation.All you have to do is leave some space after you open a bracket and continue writing leaving that much space till you close that particular brace.Once I shall start posting programs you shall understand better.
AND now the GOLDEN RULE:
- ALWAYS DEVELOP YOUR CODE CONSIDERING THAT YOU ARE THE CONSUMER.
- DEVELOP IT THE WAY IN WHICH EVEN A PERSON WHO DOES NOT NOW MUCH ABOUT COMPUTERS IS ABLE TO USE IT WITHOUT ANY PROBLEMS.
No comments:
Post a Comment