我试图让程序识别是否未输入int.
我见过以下所有内容:
if (v % 1)
Run Code Online (Sandbox Code Playgroud)
至
parseInt();
Run Code Online (Sandbox Code Playgroud)
但他们不适合我.
import java.util.Scanner;
public class LinearSlopeFinder {
public static void main(String[]args){
double x1, y1, x2, y2, n1, equation, constant = 0 ;
double slope, slope1, slopeAns;
Scanner myScanner = new Scanner(System.in);
System.out.print(" What is the first set of cordinants? example: x,y ... ");
String coordinate1 = myScanner.nextLine();
//below is what i am referring to
if (coordinate1 != int ){ // if it is a double or String
System.out.println("Sorry, you must use whole …Run Code Online (Sandbox Code Playgroud)