1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
public class Parameters {
public static void main() {
double bubble = 867.5309;
double x = 10.01;
printer(double x, double y);
printer(x);
printer("barack", "obama");
System.out.println("z = " + z);
}
public static void printer(x, y double) {
int z = 5;
System.out.println("x = " + double x + " and y = " + y);
System.out.println("The value from main is: " + bubble);
}
}
|
y without declaring and
initializing ity in the method
callprinter without the correct number of
parameters (2, in this case)printer by passing the correct type of
parameters (double, in this case)z: it is in scope
inside printer, not mainxmain that were not
passed into printer as a parameter
public class Parameters {
public static void main(String[] args) {
double bubble = 867.5309;
double x = 10.01;
double y = 5.3;
printer(double x, double y);
printer(x, 0.0);
printer("barack", "obama");
int z = 5;
System.out.println("z = " + z);
}
public static void printer(double x, double y) {
System.out.println("x = " + x + " and y = " + y);
System.out.println("The value from main is: " + bubble);
int z = 5;
}
}