Chapter 4 Flashcards
when a programmer is faced with someone else’s code, how fast should they be to be considered average or above average?
Even experienced programmers approach a new project slowly and carefully.
is programming meant to seem daunting and difficult to do?
don’t be intimidated. When you get the hang of it, programming is pretty easy. Yes, it’s fun, too.
is coding a lot of work, or is it all an easy breeze?
I admit that writing and running a Java program is a lot of work just to get the words Chocolate, royalties, sleep to appear on somebody’s computer screen, but every endeavor has to start somewhere.
what is a GUI?
it is the program that is created that contains buttons, menus, windows, text fields and other widgets that users can interact with . an example would be a software program that contains menus, buttons, text fields, windows and other widgets in like FL studio
as Java is considered a language like English,what are their similarities and what’s the difference between English and Java?
both English and Java are called languages and that is no coincidence. You use a language to express ideas. 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, they can’t.)
how does english grammar have similarities as java ?
In your high school grammar class, you worried about verbs, adjectives, and other such things. But in this book, you think in terms of keywords and identifiers
how is a keyword similar to words in english?
a keyword is a dictionary word — a word that’s built right into a language.
do keywords ever change their meaning or i should say function?
Each Java keyword has a specific meaning — a meaning that remains unchanged from one program to another. For example, whenever I write a Java program, the word public always signals a part of the program that’s accessible to any other piece of code.
when it comes to writing keywords what is something you should keep in mind if you want to avoid errors?
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. In Listing 4-1, you can’t replace public with Public. If you do, the WHOLE PROGRAM STOPS WORKING.
what is the complete list of Java keywords and how many is there?
abstract continue for new switch assert default goto package synchronized boolean do if private this break double implements protected throw byte else import public throws case enum instanceof return transient catch extends int short try char final interface static void class finally long strictfp volatile const float native super while///// there are 50 keywords in Java
are the words, “true, false and null” considered keywords?
In Java, the words true, false, and null have specific meanings. As with the keywords in Table 4-1, you can’t use true, false, and null to mean anything other than what they normally mean in a Java program. But for reasons that concern only the fussiest Java experts, true, false, and null are not called Java keywords. One way or another, if you scribble the words true, false, and null into Table 4-1, you’ll be okay.
is it possible to change the meaning of a keyword? why or why not?
Here’s one thing to remember about keywords: 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. 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: //This is BAD, BAD CODE: public = 6;
are there any keywords that you should avoid using in Java?
Despite my ardent claims in this section, two of Java’s keywords have no meaning in a Java program. Those keywords — const and goto — are reserved for nonuse in Java. If you try to create a variable named goto, Eclipse displays an Invalid VariableDeclaratorId error message. The creators of Java figure that if you use either of the words const or goto in your code, you should be told politely to move to the C++ programmers’ table.
what is an identifier?
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.
what’s the difference between a keyword and an identifier?
identifiers are the made-up words ThingsILike and args. class ThingsILike { public static void main(String args[]) { Just as the names Ann and Chrisanta have no special meaning in English, the names ThingsILike and args have no special meaning in Java. keywords cannot be changed as their meanings are set and cannot be changed and identifiers can be changed as they have no special meaning. As long as you update their name in the code, you can change the identifier name.
is it recommended to name identifiers any random name? why or why not?
Make up sensible, informative names for the things in your Java programs. Names like GooseGrease are legal, and they’re certainly cute, but they don’t help you keep track of your program-writing strategy. if you write whatever for an identifier’s name it will also confuse other users and programmers reading your code so make sure their names make sense according to the program you are building.
should you use keywords as identifiers?
When I name my Java program, I can use ThingsILike or GooseGrease, but I can’t use the word public. Words like class, public, static, and void are keywords in Java.
when it comes to boiler plate code such as public static void main string args, should you change the name of args since it is an identifier?
The args in (String args[]) holds anything extra that you type when you issue the command to run a Java program. For example, if you get the program to run by typing java ThingsILike won too 3, then args stores the extra values won, too, and 3. As a beginning programmer, you don’t need to think about this feature of Java. Just paste (String args[]) into each of your programs.
where do you find the definitions of the identifiers that were created by Java?
In Java, almost all these identifiers are defined in the Java API.