3. Write a program in java to print "Hello Name" using command line argument with taking care of possible runtime exception.
Solution
class User{
public static void main(String[] args){
String name = "";
if(args.length==1)name = args[0];
System.out.println("Hello "+name);
}
}
After compilation, run this program as follows and watch the output in next line:
prompt>java User Amit
Hello Amit
prompt>java User
Hello
Solution
class User{
public static void main(String[] args){
String name = "";
if(args.length==1)name = args[0];
System.out.println("Hello "+name);
}
}
After compilation, run this program as follows and watch the output in next line:
prompt>java User Amit
Hello Amit
prompt>java User
Hello
I have read your blog its very attractive and impressive. I like it your blog.
ReplyDeleteJava Training in Chennai Java Training in Chennai | Core Java Training in Chennai | Java Training Institutes
Online Java Training Java Online Training | Java J2EE Online Training | JavaEE Training Institute in Chennai
Nice Blog... Thank you for sharing this information..
ReplyDeleteProvident Kenworth
Vaswani Menlo Park
Marina Skies
Vasant vihar escorts
ReplyDeleteFaridabad escorts
Delhi escort services|
Bollywood escorts in Delhi|
Actress escorts in Delhi|
College escorts in Delhi|
Housewife escorts in Delhi|
Model escorts in Delhi|
Russian escorts in Delhi|
Air hostess escorts in Delhi