Wednesday, September 11, 2013

Java Program 008

Write a program TestDemo.java which accepts the number as argument and print ” You Have Entered Zero ” if the Value is equal to 0. It should print “You have entered Positive value ” if the value is greater than 0. It should print “You have entered negative value ” if the Value is less than Zero.

public class TestDemo
{
	public static void main(String[] args)
	{
		int n1 = Integer.parseInt(args[0]);
		if(n1 == 0)
			System.out.println("You have entered ZERO ");
		else if (n1 < 0)
			System.out.println("You have entered Negetive value ");
		else 
			System.out.println("You have entered positive value ");
	}
}
Blogger Labels: Simple codes,Java,Program,argument