ArrayIndexOutOfBounds Exception for program compiled using Java -


i new java. code is:

public class hi {         public static void main(string[] args) {         system.out.print("hi, ");         system.out.print(args[2]);         system.out.print(",");         system.out.print(args[1]);         system.out.print(", and");         system.out.print(args[0]);         system.out.println(".");     } } 

i following exception upon running program:

exception in thread "main" java.lang.arrayindexoutofboundsexception: 2 @ hi.main(hi.java:5) 

i glad know why had got exception , how resolve it.

you passing parameters less 3, thats why getting error.

try below command,

java hi test test test


Comments

Popular posts from this blog

Unable to open serial port using Putty to bluetooth device on windows 7 64 bit -

bash - How do you programmatically add a bats test? -

java - Getting exception in JDBC thin driver -