Methods Quiz

Last updated over 1 year ago
10 questions
1

What is a method?

1

When writing a method, you must always have an open and close what ?

1

What is output by the code below?
public class CS
{
public void one()
{
System.out.print("fun");
}
}
//code in the main of another class
CS test = new CS();
test.one();

1

What is output by the code below?
public class CS
{
public void one()
{
System.out.print("fun");
}
}
//code in the main of another class
CS test = new CS();
test.one();
test.one();

1

What is output by the code below?
public class CS
{
public void one()
{
System.out.print("fun");
}
}
//code in the main of another class
CS test = new CS();
test.one();
test.one();
test.one();
test.one();

1

What is output by the code below?
public class CS
{
public void one()
{
System.out.print("go");
}
public void two()
{
System.out.print("back");
}
}
//code in the main of another class
CS test = new CS();
test.one();
test.two();

1

What is output by the code below?
public class CS
{
public void one()
{
System.out.print("go");
}
public void two()
{
System.out.print("back");
}
}
//code in the main of another class
CS test = new CS();
test.one();
test.two();
test.two();

1

What is output by the code below?
public class CS
{
public void one()
{
System.out.print("go");
}
public void two()
{
System.out.print("back");
}
}
//code in the main of another class
CS test = new CS();
test.one();
test.two();
test.one();
test.two();

1

What is output by the code below?
public class CS
{
public void one()
{
System.out.print("go");
}
public void two()
{
System.out.print("back");
}
}
//code in the main of another class
CS test = new CS();
test.two();
test.one();
test.two();

1

What is output by the code below?
public class CS
{
public void one()
{
System.out.print("go");
}
public void two()
{
System.out.print("back");
}
}
//code in the main of another class
CS test = new CS();
test.one();
test.two();
test.two();
test.one();