Java, Java

¡Supera tus tareas y exámenes ahora con Quizwiz!

for

// for loop ____ (int i = 0; i < 9; i++) { System.out.println("" + i); }

++

// for loop for (int i = 0; i < 9; i__) { System.out.println("" + i); }

if

// if statement ____ (a == b) { System.out.println("True"); } else { System.out.println("False"); }

else

// if statement if (a == b) { System.out.println("True"); } ____ { System.out.println("False"); }

default

// switch statement _____ (color) { case "Blue": shirt = "Blue" + shirt; break; case "Red": shirt = "Red" + shirt; break; _____: shirt = "White" + shirt; System.out.println("" + shirt); }

switch

// switch statement _____ (color) { case "Blue": shirt = "Blue" + shirt; break; case "Red": shirt = "Red" + shirt; break; default: shirt = "White" + shirt; }

case

// switch statement switch (color) { _____ "Blue": shirt = "Blue" + shirt; break; _____ "Red": shirt = "Red" + shirt; break; default: shirt = "White" + shirt; }

ClassName

//build a constructor in a class public ________ () { }

130000.0

//what does this return? public class ObjectPassTest { public static void main(String[] args) { ObjectPassTest test = new ObjectPassTest(); Employee x = new Employee(); x.setSalary(120_000.00); test.foo(x); System.out.println("" + x.getSalary()); } public void foo(Employee e){ e.setSalary(130_000.00); e = new Employee(); e.setSalary(140_000.00); } }

name

//iterate over array of int int[] numbers = {100,200,300}; for (String ____:names){ System.out.println("Name" + name); }

.java

A Java class is described in a text file with a ______ extension

package

Classes in the .zip or .jar files in the class path must be zipped with the path names that are derived from the directories formed by their _______ names

braces

Code blocks are defined in ________

||

Conditional-OR

parameters

Constructors can take _______

/

Division operator

==

Equal to

constructors

Functions called during the creation of an object

methods

Functions that can be performed on an object

constructors

In addition to overloading methods, you can overload _________

++

Increment operator

class

Java fields and methods have ______ scope

accessors

Methods that get the value of each field are called ______

!=

Not equal to

private

One way to hide implementation details is to declare all of the fields _______

%

Remainder operator

immutable

Removing the setter methods and replacing the no-arg constructor guarantees that some fields can be ________

=

The assignment operator is ___

.jar

The classpath can include a .zip or _____ file

directory

The classpath can include a list of _______ names

root

The directory containing the ____ name of the package tree must be added to the class path

public

The name of the class and the file name must match when the class is declared _______

-

The unary operator that indicates a expression negation

+

The unary operator that indicates a positive number

one

There can only be ____ package declaration for a file

before

You can guarantee that an instance is fully populated with data _____ it is a valid employee object

--

decrement operator

underscore

Any number of ______ characters can appear between digits in a numeric field

float

Double numbers provide double the precision of a ______

block

Every class declaration is enclosed in a code ______

private

Keyword used when a data field or method can be accessed only within the same Java class

<=

Less than or equal to

declarations

Method _______ are enclosed in code blocks

mutators

Methods that set the value of each field are called ______

*

Multiplication operator

!

Operator to invert boolean value

public

The _____ keyword allows any class in any package to access the field or method

super

The _____ keyword may also be used to invoke a parent's method or to access a parent's (nonprivate) field //example ______ (empId, name, ssn, salary);

extends

The keyword _____ creates the inheritance relationship //example public class Manager ____ Employee { }

modifier

The keyword public in front of the class keyword is a ______ and not required

javac

To compile a Java source file, use the Java compiler called _______

main

To run a Java program, you must define a _____ method

instance

Variables, or the data associated with programs are called ________ fields

allocated

When an object is instantiated by using the new keyword, memory is ______ for the object

;

// for loop for (int i = 0_ i < 9_ i++) { System.out.println("" + i); }

while

// while loop _____ (x < 20) { System.out.print("x: " + x); x++; System.out.print("\n"); }

()

// while loop while _x < 20_ { System.out.print("x: " + x); x++; System.out.print("\n"); }

append

//adding to a StringBuilder instance StringBuilder sb = new StringBuilder("hello"); sb.______(", how are you?");

this

//build a class accessor public void setId (int id) { ____.Id = id; }

new

//create an instance ClassName cn = ___ ClassName();

new

//creating StringBuilder StringBuilder sb = ___ StringBuilder("hello");

StringBuilder

//creating StringBuilder _______ sb = new StringBuilder("hello");

length

//how to get a length of StringBuilder sb.______()

insert

//how to insert sb._____(::number::, " Fine");

names

//iterate over array of int int[] numbers = {100,200,300}; for (String name:____){ System.out.println("Name" + name); }

namespace

A package is implemented as a folder and, like a folder, provides a _______ to a class //com.example.domain +com |_+example |_+domain |_+Employee.java |_+Manager.java

F

Append an uppercase or lowercase _____ to specify a float number

L

Append an uppercase or lowercase _____ to specify a long number

instanceof

Compares an object to a specified type

&&

Conditional-AND

reference

For Java objects, the value of the right side of an assignment is a ________ to memory that stores a Java object

memory

For Java objects, the value of the right side of an assignment is a reference to ______ that stores a Java object

>

Greater than

subclassing

In Java, _______ is used to define a new class in terms of an existing one

inherited

In Java, constructors are not _______ from the parent class

primitive

Java does not pass a reference to a ______, but rather a copy of the value

?:

Ternary

value

The Java language (unlike C++) uses pass-by-_______ for all assignment operations

single

The Java programming language permits a class to extend only one other class. This is called _____ inheritance

immutable

The String class is ________

import

The ______ keyword defines other classes or groups of classes that you are using in your class

class

The ______ keyword precedes the name of a class

private

The ______ keyword, applied to fields and methods, allows access only to other methods within the class itself

package

The _______ keyword is used in Java to group classes together

+

The additive operator and string concatenation operator

final

The keyword ____ is used to declare a variable whose value may only be assigned once

new

The overloaded constructor is called based upon the parameters specified when the ____ is executed

where

The scope of an object reference depends on ______ the object is instantiated

overloading

Two rules apply to ________ methods: (1) argument lists must differ (2) return types can be different

inherit

When an existing class is subclassed, the new class created is said to ______ the characteristics of the other class

long

____ numbers have 64 bits

int

_____ rang is -2,147,483,648 to +2,147,483,647 -- 32 bits

short

_____ range is -32,768 to +32,767 -- 16 bits

command

_____-line arguments are passed to the program through the args[] array

byte

______ range is -128 to +127 -- 8 bits

static

public class Simple { public ______ void main(String args[]) }

void

public class Simple { public static ____ main(String args[]) }

main

public class Simple { public static void ____(String args[]) }

args[]

public class Simple { public static void main(String _____) }

String

public class Simple { public static void main(____ args[]) }


Conjuntos de estudio relacionados

(p. 134) Voyages of Columbus Unit 2 Chapter 4 Lesson 1

View Set

Cardiac Cycle - Homework Questions

View Set

Upper or Lower Motor Neuron Lesion?

View Set

Nur 207 - Respiratory - Saunders and Lewis

View Set