Write a Java program segment that will read in a string typed by the user and will print out a reversed copy of that string. You can assume that a Console object named console has already been created. The last character is in position number length -1, not in position number length . Explain why types are necessary. And list at least four different types that can be used in Java programs.
Every variable has a type, which determines the set of possible values that it can hold.
And a variable of type boolean can only hold the two logical values true and false . Other types in Java include double , char , long , and String . Types are necessary because what is actually stored in memory is binary numbers consisting of zeros and ones. Give an example. Parameters are used for communication between a subroutine and the rest of the program.