Kannst ihr mir helfen?
Code: Select all
import java.io.*;
import java.lang.*;
import java.util.*;
class mtdovrld
{
void rect(int a,int b)
{
int result = a*b;
System.out.println(result);
}
void rect(double a,double b)
{
double result = a*b;
System.out.println(result);
}
}
class rectarea
{
public static void main(String[] args)throws IOException
{
mtdovrld zo = new mtdovrld();
Scanner input= new Scanner(System.in);
System.out.println("Please enter values:");
// Here is the problem, how can I accept values from user where I do not have to specify datatype and will still be accepted by method?
double a = input.nextDouble();
double b = input.nextDouble();
zo.rect(a,b);
}
}