Help with beginners code?
I'm taking an Intro to Java course. Just so happens that both my class and lab are totally online, and I've never done any programming before in my life. I have to write a program that will prompt the user for random characters, and then output that string in a few different ways. The place I'm stuck right now is how to assign some sort of designation to said characters. I know for numbers, to use something like:
double number = input.nextInt();
How would I do that for a string of random letters, numbers, and symbols, to have just one name for all of them?
Also, for one of the outputs, not only do I need to have them in reverse (using stringBuilder.reverse), but only a selected number of characters, with the number being defined by the user (as shown in the example above). Where would I insert the variable "number" into stringBuilder.reverse to make it do that properly?
Re: Help with beginners code?
You cannot specify a number of chars for String builder. Have a look at String.substring(.....)
String astring = input.nextLine();