Search Header Logo
review

review

Assessment

Presentation

Computers

3rd Grade

Practice Problem

Easy

Created by

Arasaka Teacher

Used 2+ times

FREE Resource

3 Slides • 4 Questions

1

Scope

By Arasaka Teacher

2

​class outputting{ static Integer data = l; public static void outputData() { System.out.println(data); } public static void main(String args[]) { System.out.println(data); outputData();}

media

3

​public class Student { // 全局变量(成员变量) String name; // 保存学生的名字,整个类中都可以使用 // 方法,带有参数
public void sayHello(String greeting) {
// 参数变量:greeting //
局部变量:message

String message = greeting + ", " + name;
System.out.println(message); // 输出:Hello, 小明 }
public static void main(String[] args) {
Student stu = new Student();
stu.name = "小明"; // 设置全局变量 stu.sayHello("Hello"); // 传入参数变量 } }

4

Drag and Drop

public class Dog {



String name;



public void bark(int times) {



String sound = "Woof";

for (int i = 0; i < times; i++) {

System.out.println(name + ": " + sound);

}

}

public static void main(String[] args) {

Dog d = new Dog();

d.name = "Xiao Hei"; ​


d.bark(3); ​
}

}



Drag these tiles and drop them in the correct blank above
// This is a global variable
// A method with a parameter
// This is a local variable
// Set the global variable
// Call the method, pass in the parameter

5

Dropdown

public class Counter {



int totalCount = 0;

public void addCount(int number) {

int added = number * 2;

totalCount += added;

System.out.println("Added: " + added);

System.out.println("Total: " + totalCount);

}

public static void main(String[] args) {

Counter c = new Counter();

c.addCount(5);

}

}



6

Fill in the Blanks

7

Labelling

label

Drag labels to their correct position on the image

Yes, must use return to give back a valu

No (nothing to assign)

getSum()

Performs an action (e.g., print)

No return value (void)

Calculates and returns a result

Has a return value (int, String, etc.)

Scope

By Arasaka Teacher

Show answer

Auto Play

Slide 1 / 7

SLIDE