chapter 4 Flashcards
(43 cards)
Do programmers type code as fast as 100 words per minute?
No, programming is tedious. You must check for mistakes while writing and test the code multiple times.
Is learning programming difficult?
No, but it requires patience and step-by-step learning.
Is writing and running a Java program a lot of work?
Yes. Even displaying a simple sentence requires extra lines of code.
How is Java different from English?
Java is for communicating with computers; English is for humans. Java is easier since computers don’t understand English.
What are Java keywords?
Words with a fixed meaning that never changes across programs.
Is Java case-sensitive?
Yes, but identifiers (names for variables, methods, etc.) are not.
How many keywords are in Java?
- const and goto exist but are unused.
Which words look like keywords but aren’t?
true, false, null are not keywords.
Can you redefine a keyword?
No. Keywords are set by Oracle and cannot be used as identifiers.
What is an identifier?
A name used to label something in a program.
What happens if you change an identifier name?
Only the name changes, but modifying standard API names can confuse other programmers.
What is the standard API?
A list of commonly used identifier names in Java.
What is a literal?
A fixed value (like a number or text) written directly in code.
How do you write large numbers clearly in Java?
Use underscores (e.g., 1_000_000.00).
How do number separators vary in Java?
Different regions use commas, underscores, or no separators at all.
Why is punctuation important in Java?
Every bracket, brace, and symbol has a role in making code functional.
What is indentation in Java?
Indentation makes code structure clear by showing hierarchy.
How do curly braces relate to indentation?
They act like ‘boxes’ that group related code together.
How can Eclipse auto-indent code?
Select the Java file, then go to Source > Format in the menu.
What is a comment in Java?
A note for programmers that the computer ignores.
Why use comments?
Helps programmers remember their code when revisiting later.
What is a traditional comment?
A comment enclosed in /* … */. Extra * can be added for neat formatting.
What is an end-of-line comment in Java?
An end-of-line comment starts with two slashes (//) and extends to the end of the line.
How do you switch off parts of your program without deleting code?
Comment out the code; it’s like turning it on/off by adding/removing the comment symbols.