Classes Part 1 Re-Test

By Mickey Arnold
Last updated 10 months ago
6 Questions

What is output by the code below?
System.out.println( Math.sqrt(25) );

What is output by the code below?
System.out.println( (int)Math.pow( Math.sqrt(12),2) );

How many methods does Bird contain?(enter a number)
public class Bird
{
public void speak()
{
out.println("chirp-chirp");
}
public void sayName()
{
out.println("baby bird");
}
public void fly()
{
out.println("moving wings");
}
}

What is output by the code below?
public class Fun2
{
public static int times(int num1, int num2)
{
return num1 * num2;
}
}
System.out.println( Fun2.times(3 , 6) );

What is output by the code below?
public class Fun2
{
public static int times(int num1, int num2)
{
return num1 + num2;
}
}
System.out.println( Fun2.times(15 , 25) );

Methods Free Response


Directions :: Write only one method named printMethod. It should output what below. In the most efficient way possible.

Output:

"AAAAAA"
AAAAAA
'AAAAAA'
\AAAAAA\