I recently started learning java during my spare time. So to practice, I\'m making a program that takes a temperature (Celsius or Fahrenheit) and converts it to the opposite
Use Scanner Class:
int temp;
java.util.Scanner s = new java.util.Scanner(System.in);
String opposite, type;
double product;
System.out.print("Please enter a temperature: ");
temp = s.nextInt();
System.out.println("Was that in Celsius or Fahrenheit?");
System.out.print("(Enter 'C' for Celsius and 'F' for Fahrenheit) ");
type = s.nextLine();
if (type.equals("C")){
do something
}
else{
do something
}
For More Input references:
Scanner
BufferedReader
String
Here is a wonderful comparison on how to compare strings in java.