ok so how do i go about putting a String value on each element of the array ?
Type: Posts; User: Java girl
ok so how do i go about putting a String value on each element of the array ?
package practice;
import java.util.*;
import java.io.*;
public class New2 {
public static void main(String[] args) throws IOException{
String words []= new String [20];
Scanner in=...
or, well I fixed that but the error is now:
Exception in thread "main" java.lang.NullPointerException
at practice.New2.main(New2.java:19)
yes,words [] = in.nextLine(); is causing the compilation error
Well, I am still getting the ArrayIndexOutOfBoundsException error so I am unable to run it successfully.
Here is my current program:
package practice;
import java.util.*;
import java.io.*;
This is how the file i am attempting to read from is layout:
Umbrella
Rain
Jacket
Boots
Geography
Pizza
Music
Disco
Roti
Same run time error exists even after the correct format but thanks
My fixing the syntax error, the other error removed and I was able to run my program:
package practice;
import java.util.*;
import java.io.*;
public class New2 {
I decided to practice it with files instead since it is one of y weak areas so here is the updated program:
package practice;
import java.util.*;
import java.io.*;
public class New2 {
Hi,
here is my program:
package practice;
import java.util.*;
public class New2 {
public static void main(String[] args) {