How do I test whether or not what the user entered is a float or string. I want to make it so that if they enter a string than they are required to re-enter a proper number.
Java Code:
import java.io.*;
public class calculator {

	public static void main(String [] args) throws IOException {
		InputStreamReader kam = new InputStreamReader(System.in);
		BufferedReader ryan = new BufferedReader(kam);
		boolean gulati = false;
		boolean gulati2 = false;
		String calc;
		float kam1, kam2;
		System.out.println("Welcome to Daniel's Calculator");
		System.out.println("Please choose what kind of calculation you want to perform, +,-,x,/");
		calc = ryan.readLine();
		if (calc.equals("+")){
			do
			{System.out.println("Please Enter your first number");
			kam1 = ryan.read();
			if(!(kam1 > 0) || !(kam1 == 0) || !(kam1 < 0)){
				System.out.println("This is not a number");
			}
			else{
				gulati = true;
			}
			}while (gulati = false);
			
			do{ 
				System.out.println("Please Enter your seond number");
				kam2 = ryan.read();
				if(!(kam2 > 0 || kam2 == 0 || kam2 < 0)){
					System.out.println("This is not a number");
				}
				else{
						System.out.println("The answer is " + kam1 + kam2);
						gulati2 = true;
				}
			
			}while ((gulati2 = false)||(gulati = true) );
			
		
		}
		
	}
}