chapter 4 Flashcards
(40 cards)
do programmers approach a new project fast and easy?
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.
what kind of program displays in the console view?
When you run a text based program, the input and output appears in Eclipse’s Console view.
what is a GUI program?
a GUI (graphical user interface) program displays windows, buttons, text fields, and other widgets to interact with the user.
What are the similarities between English and Java and what are the differences and which ones easier to learn?
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,
is it important when using capitals or lower case letters in your code? why?
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.
can you change the meaning of a java keyword?
Java keyword has a specific meaning — a meaning that remains unchanged from one program to another.
what 3 words are not java keywords but can be mistaken as keywords?
true, false, and null are not called Java keywords.
what do java keywords posess that is predetermined? who created the java 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:
can you change the meaning of a java keyword?
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:
what is a java 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.
how does an identifier name relate to it’s meaning? where can you find the definition of java identifiers?
Most programming languages have identifiers with agreed-upon meanings. In Java, almost all these identifiers are defined in the Java API.
what is a literal in Java?
A literal is a chunk of text that looks like whatever value it represents.
what symbol is permissible when writing numbers as literals in a java program?
Starting with Java 7, numbers with underscores are permissible as literals.
in java what do curly braces act like?
A pair of curly braces acts like a box.
why is it important to indent your code carefully?
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 important is indenting your code?
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.
how do you indent your code automatically with Eclipse?
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.
what are the 2 purposes for comments in a java program?
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.
what are the three types of comments in Java?
The Java programming language has three kinds of comments:
Traditional comments
End-of-line comments
Javadoc comments
how do your write a traditional comment and how does it work?
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.
how do you write an end of line comment and what does it do?
An end-of-line comment starts with two slashes and extends to the end of a line of type.
why would anyone comment out some code rather than deleting code when testing suspicious code?
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.
how do you write a javadoc comment and what can a javadoc create?
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.