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.
Blogger Labels: Simple codes,Java,Program,argumentpublic 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 ");elseSystem.out.println("You have entered positive value ");}}
No comments:
Post a Comment