jobsbion.blogg.se

Greenfoot add object to world from actor
Greenfoot add object to world from actor







greenfoot add object to world from actor

– Disappear once a constructor is finished executing. – Have a restricted lifetime limited to the single execution of the constructor. – Have a restricted scope limited to when the constructor is declared. These parameters: – Are only available to the instance created by the constructor. A constructor’s parameters allow an instance’s initial values to be passed into the constructor.Constructors are special methods that are executed automatically whenever a new instance of the class is created. – Their name, immediately following the word “public,” is the same as the class in which they are defined. Constructors set up the instance and establish an initial state, such as the size and resolution of the instance.When a new World subclass is created and compiled, Greenfoot executes a constructor that creates an instance of it to display in the scenario.Write programming statements to end a game 2.Write programming statements to switch between two images.Recognize the syntax to define and test variables.Define the purpose and syntax of a variable.Write programming statements to use the new keyword.Construct a world object using a constructor method.

greenfoot add object to world from actor

Overview This lesson covers the following topics: All rights reserved.Ĭreating a World, Animating Actors, and Ending a Game 6.Creating Java Programs with Greenfoot Creating a World, Animating Actors, and Ending a GameĬopyright © 2012, Oracle and/or its affiliates. Which of the following is not a component of a while loop? Mark for Review (1) Points while keyword if statement (*) Control operator Loop variable Local variable Incorrect. In Greenfoot, what types of values cannot be stored in a local variable? Mark for Review (1) Points Method (*) Class name World name Objects Integers Correct 5. Image files from 1-119 are associated with image1.

greenfoot add object to world from actor

(*) The variable, image1, cannot use the image file, duke12.png. The image file, duke12.png, is assigned to the variable image1. What does the following programming statement mean?image1 = new GreenfootImage(“duke12.png”) Mark for Review (1) Points The image file, duke12.png, has just been drawn and imported into the scenario. Defines the access specifier used with the variable. Defines the instance that the variable is associated with. (*) Defines which class the variable is associated with. In Greenfoot, what is the purpose of the variable type? Mark for Review (1) Points Defines what kind of data to store in the variable. In Greenfoot, which method body correctly adds an instance of the World to a scenario, with size x = 300 y = 300 and a resolution of 2 pixels per cell? Mark for Review (1) Points super(300,300,2) (*) Super(300,300,2) world(300, 300, 2) super(2,300,300) Correct 2.

GREENFOOT ADD OBJECT TO WORLD FROM ACTOR CODE

In Greenfoot, after a subclass is created, what has to occur before instances can be added to the scenario? Mark for Review (1) Points Creation of an instance Editing of source code Compilation (*) Creation of source code Incorrect. True or false? Mark for Review (1) Points True (*) False Correct 15. From your Greenfoot lessons, the reset button resets the scenario back to its initial position. True or false? Mark for Review (1) Points True False (*) Incorrect. In Greenfoot, after a subclass is created and compiled, you cannot edit the subclass’s source code. A subclass has what kind of relationship to a superclass? Mark for Review (1) Points “a-is” “is-by” “is-a” (*) “for-what” Incorrect. True or false? Mark for Review (1) Points True (*) False Correct 12. When designing a game in Greenfoot, it helps to define the actions that will take place in a textual storyboard. In Greenfoot, which of the following options are not possible when associating an image file with an instance? Mark for Review (1) Points Add a video (*) Import an image Draw an image Select an image from the Greenfoot library Correct 11. In Greenfoot, the move method expects what type of information in its parameters? Mark for Review (1) Points Integer of steps to move forward (*) Degrees to turn True or false response String statement Correct 10. In Greenfoot, the body of the method is located in between which of the following characters? Mark for Review(1) Points Square brackets Curly brackets (*) Asterisks ** Incorrect. In Greenfoot, the move method expects what type of information in its parameters? Mark for Review(1) Points Degrees to turn True or false response Integer of steps to move forward (*) String statement3.

greenfoot add object to world from actor

Which of the following is an incorrectly written programming statement? Mark for Review(1) Points move(2) move(): (*) turn(25) turn(2) 2.









Greenfoot add object to world from actor