You are on page 1of 4

OUTPUT:

Tiada ralat (subaturcara total ada


2 tapi satu ada parameter) –
method overloading

Method result = 20
Some Text Here
int num = 10; Will the values from main be changed after
double decimal = 5.4; being sent to this method??
// ANSWER: In this case, NO.
The output will be: num = 10
NumberManeuvers(num, decimal); and decimal = 5.4

System.out.println("num = " + num + "and


decimal = " + decimal);
----------------------------------------------------------------
public static void NumberManeuvers(int i, double j)
{
if (i == 10)
j = 6.2;
i = 12; }
}
int a = 2, b = 3, c = 4, answer = 2; What will
happen to
answer = discriminant(a, b, c);
the values
System.out.println("The discriminant is " + in main
answer); after being
------------------------------------------------------------
sent to this
public static int discriminant(int x, int y, int method??z)
{
OUTPUT:
int disc;
disc = y*y - 4*x*z;
return disc;
}
String dog = "My dog has fleas."
dog = SpeciesChange(dog);
System.out.println("dog);

public static String SpeciesChange(String


pet)
{
OUTPUT:
pet = "My cat has fleas.";
return (pet);
}

You might also like