Im relatively new to Java and cant seem to get a straight answer from my lecturer at college, so I apologise if this is a dumb question. I'm creating a level up screen for my assignment, and it needs to include an array.
I've created a string array called "randomTitle" containing a list of character titles, I need a button to pull a random title from my array list and display it on a JLabel on my level up screen, but am unsure how to save the random title returned as a variable in order to display it, can anyone help me?
Random ran = new Random();
String ary = randomTitle[ran.nextInt(randomTitle.length)];
titleJLabel.setText(String.valueOf(randomTitle));
aryis, then you might know it.