Why it is not working "CmdLineArgsApp.class"
Virtual Position Forum :: Members Lounge :: Sciences & Knowledge :: Programing and Design :: Java Forum
Page 1 of 1 • Share
Why it is not working "CmdLineArgsApp.class"
AOA Sir,
Here is the message when run the "java CmdLineArgsApp"
D:\java>java CmdLineArgsApp
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at CmdLineArgsApp.main(CmdLineArgsApp.java:7)
What is wrong with it?
Here is the message when run the "java CmdLineArgsApp"
D:\java>java CmdLineArgsApp
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at CmdLineArgsApp.main(CmdLineArgsApp.java:7)
What is wrong with it?
Diya- Monstars
-
Posts : 364
Join date : 2011-02-08
Age : 32
Character sheet
Experience:
(10/500)
Re: Why it is not working "CmdLineArgsApp.class"
When while running CmdLineArgsApp you do not provide any command line arguments you get this exception.
Because in the code args[0] and args[1] are being used , if we do not provide any argument at command line, args[0] and args[1] do not have any value and exception is generated.
You can place a check to avoid this exception, you can check for number of element (i.e. check the value of args.length ) in args array if they are greater then 0 then proceed futher.
Because in the code args[0] and args[1] are being used , if we do not provide any argument at command line, args[0] and args[1] do not have any value and exception is generated.
You can place a check to avoid this exception, you can check for number of element (i.e. check the value of args.length ) in args array if they are greater then 0 then proceed futher.
Vuhelper- Deep Bench
- Posts : 97
Join date : 2011-05-29
Similar topics
» LMS not working
» LMS not working
» HTML and CSS working
» Working Holiday Visa for Australia
» Java working High-performance for all platforms
» LMS not working
» HTML and CSS working
» Working Holiday Visa for Australia
» Java working High-performance for all platforms
Virtual Position Forum :: Members Lounge :: Sciences & Knowledge :: Programing and Design :: Java Forum
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
Mon Apr 22, 2024 11:23 am by Joshuaadam
» Aloha Planner - Note-Taker
Thu Apr 11, 2024 4:52 pm by ali001
» Streaming Guide Film TV Series
Tue Apr 09, 2024 9:39 pm by ali001
» Apricot Tree Problems & Solutions ????|خوبانی کے پھل کو کیڑا لگنےسے بچانے کا طریقہ ????
Sun Apr 07, 2024 6:28 am by Zamaan Khan
» خوبانی کے پودے کی کاشت گرم علاقوں میں کرنی چاہیے یا نہی
Sun Apr 07, 2024 6:24 am by Zamaan Khan
» New Here
Sun Apr 07, 2024 6:15 am by Zamaan Khan
» Bajta Hua Sochoon Main Koi Saaz Na Aaye Naat
Sun Apr 07, 2024 6:14 am by Zamaan Khan
» Woh Pagal Si Episode 52 to 62 - Top Pakistani Drama
Sun Apr 07, 2024 6:06 am by Zamaan Khan
» Woh Pagal Si Episode 42 to 51 - Top Pakistani Drama
Sat Apr 06, 2024 4:50 pm by Ch. Ehtisham Gujjar