chapter 3 Flashcards
how do you get the console view to appear if it isn’t already there?
You may not see a Console tab in the lower-right part of the Eclipse workbench. To coax the Console view out of hiding, choose Window ⇒ Show View ⇒ Other. In the resulting Show View dialog box, expand the General branch. Finally, within that General branch, double-click the Console item.
if you wanted to stop a program from running dead in it’s tracks at runtime, what should you do?
Occasionally, you decide in the middle of a program’s run that you’ve made a mistake of some kind. You want to stop the program’s run dead in its tracks. Simply click the little red square above the Console view.
what are two ways to create a seperate workspace in Eclipse?
Here are two ways to create a new workspace: When you launch Eclipse, type a new folder name in the Workspace field of Eclipse’s Workspace Launcher dialog box. If the folder doesn’t already exist, Eclipse creates the folder. If the folder already exists, Eclipse’s Package Explorer lists any projects that the folder contains.
On the Eclipse workbench’s main menu, choose File ⇒ Switch Workspace. (See Figure 3-6.) When you choose File ⇒ Switch Workspace, Eclipse offers you a few of your previously opened workspace folders. If your choice of folder isn’t in the list, select the Other option. In response, Eclipse reopens its Workspace Launcher dialog box.
how important is it when it comes to using capital letters or lowercase letters when writing java programs?
Java is case-sensitive, which means that system.out.printLn isn’t the same as System.out.println. If yOu tyPe system.out.printLn, your progrAm won’t worK. Be sUre to cAPItalize your codE eXactLy as it is in
when using quotation marks in your code what is important to keep in mind?
If you copy and paste code from an ebook, check to make sure that the quotation marks in the code are straight quotation marks (“”), not curly quotation marks (“ ”). In a Java program, straight quotation marks are good; curly quotation marks are troublesome.
what happens if you do not type in code correctly? what kind of signs do you see that indicate there is something wrong with your code?
If you don’t type the code correctly, you may see jagged red underlines, tiny rectangles with X-like markings inside them, or other red marks in the editor.
what kind of error prevents the computer from translating your code?
The red marks in Eclipse’s editor refer to compile-time errors in your Java code. A compile-time error (also known as a compiler error) is an error that prevents the computer from translating your code.
how do you display line numbers in eclipse’s editor if they are not already showing?
Line numbers appear in the editor’s left margin. To make Eclipse’s editor display line numbers, choose Window ⇒ Preferences (in Windows) or Eclipse ⇒ Preferences (on a Mac). Then choose General ⇒ Editors ⇒ Text Editors. Finally, put a check mark in the Show Line Numbers check box.
what can you do if you have a jagged red underline appear in your code?
you can hover the mouse pointer over the jagged red underline. When you do, you see a brief explanation of the error along with some suggestions for repairing the error — some quick fixes.
when using the eclipse editor you see certain words in different colors. is this formatting?
When you use Eclipse’s editor to write a Java program, you see words in various colors. Certain words are always blue. Other words are always black. You even see some bold and italic phrases. You may think you see formatting, but you don’t. Instead, what you see is called syntax coloring or syntax highlighting.
how is syntax highlighting useful?
With a Java program editor, things like bold and coloring aren’t marked inside the Java program file. Instead, the editor displays each word in a way that makes the Java program easy to read.
besides looking out for compile time errors in your code, what are 3 things to watch out for in your code?
In addition to compile-time errors, some other kinds of gremlins can hide inside a Java program: such as, unchecked runtime exceptions, logic errors, compile time warnings
what is an unchecked runtime exception? when does an unchecked runtime exception occur?
Eclipse’s editor doesn’t warn you about an unchecked runtime exception because, until you run the program, the computer can’t predict that the exception will occur.
describe 3 things about logic errors
Logic errors are the most challenging errors to find and to fix. And worst of all, logic errors often go unnoticed.
how serious are compile time warnings? describe the appearance of compile time warnings
A warning isn’t as severe as an error message. So, when Eclipse notices something suspicious in your program, the editor displays a jagged yellow underline, a tiny yellow icon containing an exclamation point, and a few other not-so-intrusive clues.
what is indicated when you spot a compile time error? and what should you do when a compile time error occurs? should a compile time error be fixed before running your program or continuing to write your code?
When you’re sure that you know what you’re doing, you can ignore warnings and worry about them at some later time. But a warning can be an indicator that something more serious is wrong with your code. My sweeping recommendation is this: Pay attention to warnings. But, if you can’t figure out why you’re getting a particular warning, don’t let the warning prevent you from moving forward.