• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

CAN ANY BODY MADE THIS

 
khurram babar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Write a program that throws an exception when the user doen not enter any arguments at the command line The program should also display the number of arguments
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doing your own homework is both mentally and spiritually rewarding.
 
John Lee
Ranch Hand
Posts: 2545
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you want to learn java, the best way is to write program.
 
Donald R. Cossitt
buckaroo
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Can anybody made this?

Maybe not anybody, but nearly.
 
Marilyn de Queiroz
Sheriff
Posts: 9066
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is a start.

 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is a start.

Do I detect a sarcastic tone here?
 
Francis Siu
Ranch Hand
Posts: 867
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi khurram
Thomas said
Doing your own homework is both mentally and spiritually rewarding.
Absolute agree
Do I detect a sarcastic tone here?

My suggestion is that when you compile the coding which is finished all the requirement of your homework and contains some error,you can post it to us to discuss what wrong with it.
No ones will get the experience if they do not write the coding.
One more question if you want to answer,
Do you like Java language or writing program?
 
Yogini Shirodkar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi here is the code
public static void main(String arg[])
{
try{
if(arg.length==0)
{
throw new Exception();
}
}
catch(Exception e)
{
System.out.println(" Please pass the command line argument ");
}
finally
{
System.out.println(" Toatal number of arguments are "+arg.length);
}
}
 
Junilu Lacar
Bartender
Posts: 7605
54
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
:roll: There's always somebody who doesn't get it...
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic