chapter 4 Flashcards

1
Q

do programmers approach a new project fast and easy?

A

Don’t believe the wise guys who say they never go through careful step by steps when programming. Even experienced programmers approach a new project slowly and carefully.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what kind of program displays in the console view?

A

When you run a text based program, the input and output appears in Eclipse’s Console view.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what is a GUI program?

A

a GUI (graphical user interface) program displays windows, buttons, text fields, and other widgets to interact with the user.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the similarities between English and Java and what are the differences and which ones easier to learn?

A

English expresses ideas to people, and Java expresses ideas to computers. What’s more, both English and Java have things like words, names, and punctuation. In fact, the biggest difference between the two languages is that Java is easier to learn than English. (If English were easy, computers would understand English. Unfortunately,

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

is it important when using capitals or lower case letters in your code? why?

A

The java proGRAMMing lanGUage is case-sensitive. ThIS MEans that if you change a lowerCASE LETTer in a wORD TO AN UPPercase letter, you chANge the wORD’S MEaning. ChangiNG CASE CAN MakE the enTIRE WORD GO FROM BeiNG MEANINGFul to bEING MEaningless.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

can you change the meaning of a java keyword?

A

Java keyword has a specific meaning — a meaning that remains unchanged from one program to another.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what 3 words are not java keywords but can be mistaken as keywords?

A

true, false, and null are not called Java keywords.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what do java keywords posess that is predetermined? who created the java keywords?

A

In Java, each keyword has an official, predetermined meaning. The people at Oracle, who have the final say on what constitutes a Java program, created all of Java’s keywords.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
A

You can’t make up your own meaning for any of the Java keywords. For example, you can’t use the word public in a calculation:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

can you change the meaning of a java keyword?

A

You can’t make up your own meaning for any of the Java keywords. For example, you can’t use the word public in a calculation:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what is a java identifier?

A

In computer programming, an identifier is a noun of some kind. An identifier refers to a value, a part of a program, a certain kind of structure, or any number of things.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

how does an identifier name relate to it’s meaning? where can you find the definition of java identifiers?

A

Most programming languages have identifiers with agreed-upon meanings. In Java, almost all these identifiers are defined in the Java API.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

what is a literal in Java?

A

A literal is a chunk of text that looks like whatever value it represents.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

what symbol is permissible when writing numbers as literals in a java program?

A

Starting with Java 7, numbers with underscores are permissible as literals.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

in java what do curly braces act like?

A

A pair of curly braces acts like a box.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

why is it important to indent your code carefully?

A

I can’t emphasize this point enough: If you don’t indent your code or if you indent but you don’t do it carefully, your code still compiles and runs correctly. But this successful run gives you a false sense of confidence. The minute you try to update some poorly indented code, you become hopelessly confused.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

how important is indenting your code?

A

Take my advice: Keep your code carefully indented at every step in the process. Make its indentation precise, whether you’re scratching out a quick test program or writing code for a billionaire customer.

18
Q

how do you indent your code automatically with Eclipse?

A

Eclipse can indent your code automatically for you. Select the .java file whose code you want to indent. Then, on Eclipse’s main menu, choose Source ⇒   Format. Eclipse rearranges the lines in the editor, indenting things that should be indented and generally making your code look good.

19
Q

what are the 2 purposes for comments in a java program?

A

Instead, the comment tells other programmers something about your code.

Comments are for your own benefit, too. Imagine that you set aside your code for a while and work on something else. When you return later to work on the code again, the comments help you remember what you were doing.

20
Q

what are the three types of comments in Java?

A

The Java programming language has three kinds of comments:
Traditional comments
End-of-line comments
Javadoc comments

21
Q

how do your write a traditional comment and how does it work?

A

traditional comments begin with /* and ends with /. Everything between the opening / and the closing / is for human eyes only. Nothing between / and */ gets translated by the compiler.

extra asterisks. I call them “extra” because these asterisks aren’t required when you create a comment. They just make the comment look pretty.

22
Q

how do you write an end of line comment and what does it do?

A

An end-of-line comment starts with two slashes and extends to the end of a line of type.

23
Q

why would anyone comment out some code rather than deleting code when testing suspicious code?

A

You may hear programmers talk about commenting out certain parts of their code. When you’re writing a program and something’s not working correctly, it often helps to try removing some of the code. If nothing else, you find out what happens when that suspicious code is removed. Of course, you may not like what happens when the code is removed, so you don’t want to delete the code completely. Instead, you turn your ordinary Java statements into comments.

24
Q

how do you write a javadoc comment and what can a javadoc create?

A

A special Javadoc comment is any traditional comment that begins with an extra asterisk:This is a cool Java feature. The Java SE software that you download from Oracle’s website includes a little program called javadoc. The javadoc program looks for these special comments in your code. The program uses these comments to create a brand-new web page — a customized documentation page for your code.

25
Q

what is a method?

A

a method is a bunch of instructions collected together and given a new name.

26
Q

what is the relationship of a method header and a body similar to?

A

A method’s header and body are like an entry in a dictionary. An entry doesn’t really use the word that it defines. Instead, an entry tells you what happens if and when you use the word

27
Q

What is a method in Java?

A

A block of code that performs a specific task and can be called when needed.

28
Q

What is a method call?

A

The act of invoking a method using its name and passing any required arguments.

29
Q

What is the method body?

A

The code inside the curly braces {} of a method that contains the logic to execute.

30
Q

What is a method declaration?

A

The first part of the method definition that specifies its return type, name, and parameters.

31
Q

what is a statement and how many things can it do in a java program?

A

In Java, a direct instruction that tells the computer to do something is called a statement.The statements in programs may tell the computer to put 7 in a certain memory location or make a window appear on the screen. The statements in computer programs do all kinds of things.

32
Q

what characteristic helps you know what is a statement?

A

In Java, each statement ends with a semicolon.

33
Q

does a method header tell the computer what to do?

A

The method header doesn’t directly tell the computer to do anything. Instead, the method header describes some action for future reference. The header announces “Just in case someone ever calls the method, the next few lines of code tell you what to do in response to that call.”

34
Q

what is the difference between a statement, a header or a declaration?

A

Every complete Java statement ends with a semicolon. A method call is a statement, so it ends with a semicolon, but neither a method header nor a method declaration is a statement.

35
Q

what is the purpose for the method System.out.println?

A

Whenever you call the System.out.println method, the computer displays text on its screen.

36
Q

why would programmers want to change the acronym OOP to COP?

A

Some people want to change the acronym object oriented programming (OOP) and call it COP — class-oriented programming. That’s because object-oriented programming begins with something called a class. In Java, everything starts with classes, everything is enclosed in classes, and everything is based on classes. You can’t do anything in Java until you’ve created a class of some kind.

37
Q

what character appears at the end of a class? what is the purpose for this character? and why do you need this character in your code?

A

after a class comes a curly brace and the braces mark all the stuff inside the class. without braces you’d know where the class begins but you wouldn’t know where the declaration ends.

38
Q

why do you need curly braces in your java code?

A

You use curly braces. These curly braces tell the compiler where a chunk of code begins and ends.

39
Q

why do you need to indent your code?

A

You indent code. Indentation tells your human eye (and the eyes of other programmers) where a chunk of code begins and ends.

40
Q
A