Menu

(Solved) : Getting Null Pointer Exception Run Code Q43937862 . . .

moyol.uva. 1° public class HugeInteger {r public int[] array; public int size; public Huge Integer(String val){ REEBOVOU A WN1. public class Main { public static void main(String args[]) { Huge Integer num = new Huge Integer (1000); //creating new

Why am I getting the null pointer exception when I run mycode

moyol.uva. 1° public class HugeInteger {r public int[] array; public int size; public Huge Integer(String val){ REEBOVOU A WNH int size = val.length(); 7/sets length of string to size int [] array = new int [val.length(); //sets Length of string to length of string for (int i = 0; i < val.length(); i++) { array[i] = Character.getNumericValue(val.charAt(i); //creates array of numbers from string 14 15 } 16 ] 17 18 1. public class Main { public static void main(String args[]) { Huge Integer num = new Huge Integer (“1000”); //creating new object and passing “1000” system.out.print(num.array[@]); //Trying to print element of the num array but keep getting //null pointer exception Show transcribed image text moyol.uva. 1° public class HugeInteger {r public int[] array; public int size; public Huge Integer(String val){ REEBOVOU A WNH int size = val.length(); 7/sets length of string to size int [] array = new int [val.length(); //sets Length of string to length of string for (int i = 0; i

Expert Answer


Answer to Why am I getting the null pointer exception when I run my code…

OR