r/javahelp • • Dec 08 '20

String array help

So for assignment for my java class, I have to make a program that manipulates strings. One part of the program i have a file where I read in a list of string. Then I have a method which splits the string which is separated by "/". Then that method puts it into a array[]. So when I tried to return the array it kept giving me type mismatch error.

Code:

Public static String[ ] breaksupstr(String n){ String[] arrstr=n.split("/", 3); } Return arrstr; }

Error return invalid type.

0 Upvotes

3 comments sorted by

View all comments

3

u/Camel-Kid 18 year old gamer Dec 08 '20

you need to put that into some ide and format it, you will quickly see that you have mismatching braces.