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

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -