CH. 2- Intro to Java

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

What symbol it used to end a Multi-Line Comment?

*/

All bytecode files end with what suffix?

.class

All Java programs end with what suffix?

.java

What symbol it used to start a Multi-Line Comment?

/*

What symbol it used to make a Single-Line Comment?

//

What punctuation symbols must be at the end of all Java program statements?

;

Refer to the previous question. How is a Java compiler different?

A java compiler does not create a fully-compiled .exe file, Instead it creates a mostly-compiled .class file

What does AVR stand for?

Automatic voltage regulation

What characters contain program blocks?

Braces

What is the intermediate code created by the Java compiler?

Bytecode

If you were to compare the executing of a Java file with the UN, how would "bytecode" fit in with the UN analogy?

Bytecode is English

Bytecode files are low-level, does this make them executable?

Cannot execute as a regular machine code file

What does CRLF stand for?

Carriage return line feed

Look at Figure 2.3. The first 5 lines of program Java0201.java all begin with //. What does that mean?

Comments

If you see public class Jessica in your program, what name must the file have?

Jessica.java

What does the command System.out.println do?

It displays the characters placed between the double quotes that follow

\r

Moves to front of current line (reverse) performs only a carriage-return without a line-feed Ex. INPUT: System.out.println(" comp\rpsci"); OUTPUT: psci

\n

Moves to front of next line Performs a carriage-return and a line-feed. (Like pressing the enter key.) Ex. INPUT: System.out.println("comp\nsci"); OUTPUT: Comp Sci

\\

Nets (It shows) one backslash \ displays a single backslash Ex. INPUT: System.out.println("\\compsci/"); OUTPUT: \compsci/

\"

Nets (It shows) one double quote " Ex. INPUT: System.out.println("\"compsci\""); OUTPUT: "compsci"

\'

Nets (It shows) one single quote ' Ex. INPUT: System.out.println(" comp\'sci"); OUTPUT: comp'sci

Are comments compiled into bytecode?

No

Are comments ever executed?

No

Can a website be written entirely in Java?

No

Is JCreator the only IDE available?

No

Can a programming language use human language? Why or why not?

No because words change meanings

Comments are very useful because they aid in ______

Program Documentation

What is an application?

Program designed to operate in a stand-alone environment

What is an applet?

Program designed to operate inside a web page

Which is more complex, program input or program output?

Program input

What does RAM stand for?

Random access memory

What does println() do when there is nothing between the (parentheses)?

Skip a line

Both print and println follow what Java keyword(s)?

System.out

\t

Tabs over five spaces performs a horizontal tab Ex. INPUT: System.out.println("com\tpsci"); OUTPUT: Com psci

In the textbook, the JDK file name is jdk-8-windows-i586.exe. If you download the JDK today, you might notice the file name is a little different. What would this indicate?

There has been another update

Look at the program Java0208.java and its output. Why does the program not display the words Seven, Eight, Nine, Ten and Eleven?

They have been commented out

Two or more keywords combine to make what?

To make a program statement

For most languages, what does a compiler do?

Translates the entire source code file into an executable file before execution.

What is a Java keyword?

Word that has a special meaning in a program or performs a special function

Can Notepad be used to write a Java program?

Yes

Can a comment be placed right after a program statement?

Yes

Can a website contain multiple applets?

Yes

Can the Java compiler be accessed from the Command Prompt?

Yes

Why is it bad to leave your computer both logged in and unattended?

You can easily lose your stuff

Explain why the United Nations "2-step translation" process requires fewer translators than a "1-step translation" process.

You only need 1 translator for every language and English

Physical damage to a computer happens, but it is not the biggest problem. The number one source of grief for many people, especially students, is

loss of data

Every application program has a _______________ segment.

main

Application

• A Java program designed to operate in a stand-alone environment.

Applets

• A Java program designed to operate inside a web page.

Platform Independent

• A programming language is considered platform independent or portable if any program created in that language on one computer will work and have the exact same output on any other computer.

Keyword

• A word that has a special meaning in the program or performs a special function. • Keywords in Java are case-sensitive

JDK

• Installing Java software JDK comes from Oracle and must be installed before the IDE. • Java Runtime Environment (JRE), allows you to execute Java programs, but it does not allow you to compile them. • This is why we need to install the Java Development Kit (JDK). With the JDK, we can do both.

IDE

• Integrated Development Environment (IDE) combines features of all 3. • Use Notepad to write a Java program and then- at the Command Prompt- use a second piece of software to compile your program and a third to execute it. • Ex. (jGRASp, BlueJ, DrJava, Eclipse, JBuilder, NetBeans, JCreator.)

Program Statement

• One or more keywords combine • Most program statements ends with a semi-colon

Basic Java Tools

• Text editor- to write Java program source code. • Compiler- to translate source code into bytecode. • Interpreter- to translate and execute bytecode.

Bytecode

• The intermediate code created by the Java compiler. Low-level code file that cannot execute as a regular machine code file. • Is understood, and executed, by a Java interpreter, called the Java Runtime Environment (JRE).

System.out.print

• The keyword print generates display without a crlf. • Meaning it prints to the screen, but does not break to a new line.

System.out.println

• They keyword println generates display followed by a carriage-return/linefeed (CRLF) • Meaning skip a line, without any other display

Java is an island in what country?

Indonesia

Where can comments be used in a program?

Anywhere

Which are larger, compilers or interpreters?

Compilers

\b

Deletes previous character (backspace) performs a backspace Ex. INPUT: System.out.println("comp\bsci"); OUTPUT: comsci

What 3 things do you need to write a Java program?

Editor, compiler, and interpreter

What would happen if the slash at the very end of this comment were removed?

Everything after would be considered a comment and not compile.

How much does it cost to download the JDK from Oracle's website?

Free

What does GUI stand for?

Graphical User Interphase

What does HTML stand for?

Hyper Text Markup Language

When is it useful to completely comment-out a program statement?

If a program statement has an error that you cannot fix right now

When is a programming language considered to be platform independent?

If any program created in that language on one computer will work and have the exact same output on any other computer.

Refer to the previous question. Some software packages combine all 3 of these things into an IDE. What does IDE stand for?

Integrated Development Environment

An _____________ translates one line of source code at a time during execution.

Interpreter

To make JCreator function on your computer, you must install both JCreator and the JDK. Which must be installed first?

JDK

Bytecode is understood, and executed, by a Java interpreter, called a ________________.

JVM

What does JDK stand for?

Java Development Kit

What does JRE stand for?

Java Runtime Environment

What is spyware?

Snoops around your computer and tries to record information

What are the 2 parts of a computer virus?

The duplication and payload

What does System.out mean?

The output of the system

Explain the difference between print and println.

The print keyword generates output without a crlf and the println keyword generates output with a crlf

What does it mean when we say that keywords in Java are "case-sensitive"?

This means that system is a java keyword, which is not the same as system

What does USB stand for?

Universal serial bus

What happens to the RAM if the computer loses power?

Your information will be gone

What is the escape sequence to generate a back space?

\b

What is the escape sequence to generate a carriage-return, line-feed?

\n

What is the escape sequence to generate a carriage-return without a line-feed?

\r

What is the escape sequence to generate a tab?

\t

Java uses a _____________ to translate programmer's source code into bytecode and then continues with a ____________to translate and execute the bytecode file line by line.

compiler, _interpreter

List 9 keywords.

public, class, static, void, main, String, System, out and println.

A well-documented program is easier to

read, debug, update, and enhance

Interpreter

• Translate the bytecode into machine code line by line during execution.

Compiler

• Translate the program source code (.java file created by the programmer) into bytecode (.class file).


Conjuntos de estudio relacionados

Peds ATI Chapter 14 (Head Injury)

View Set

HSF - Development of Heart I (L1,B2)

View Set