There is more to being a successful programmer than writing programs that execute without
generating errors. To truly be a professional, you need more than a knowledge of Java syntax.
For example:
Your programs might work, but be inefficient. Throughout this book, you have been
encouraged to understand that there are often multiple ways to tackle the same problem, and
that some ways are more efficient or more elegant. For example, storing related values in an
array is almost always more elegant that storing them in a series
of separate variables.
Your programs might work, but not adhere to your organization’s coding standards.
For example, throughout this book you have been encouraged to use reasonable names for
variables rather than shorter, but cryptic, ones. Similarly, you have learned to use named
constants rather than to use unnamed constant values in your programs. Your employer might
have many more such standards.
Achieving success at a job interview involves being able to think on your feet, but
you can still be prepared. The Tough Questions presented here are organized by chapter. They
are similar to questions that an interviewer might ask at a technical job interview. Some require
you to write a program that is more difficult than those presented in the end-of-chapter
exercises in the book. After completing each chapter, you have the knowledge needed to write
the programs suggested here, but the thought process required might be a little deeper or
trickier.
Job interview success also sometimes depends on how articulate you are in
expressing opinions on a variety of topics. You can read many books on career advice that
describe typical generic interview questions such as “Where do you want to be five years from
now?” and “Tell me about a problem you had with a former boss and how you were able to
solve it”. The Up for Discussion questions presented here, and organized by chapter, are meant
to probe your thoughts on topics that are more
, lOMoAR cPSD| 14985576
specifically relevant to computer programmers and other business professionals. A particular
question might have several good answers. If you can’t think of an answer right away, try
doing some research on the Web or in other Java books.
Chapter 1
Tough Questions
1. Describe Java and how it differs from other programming languages.
For a job interview, you might start my memorizing this sentence:
Java is a simple, object-oriented, network-savvy, interpreted, robust, secure, architecture
neutral, portable, high-performance, multithreaded, dynamic language. Although the
meaning of all these terms won’t become clear until you have studied the language
further, you should at least appreciate that unlike older languages, it is object- oriented,
that it has a built-in library of routines that facilitate creating network connections, and
that it is interpreted meaning Java bytecodes are translated into machine instructions
while a program is running, giving Java its “write once; run anywhere” capability.
You might also mention that Java is a compiled language.
2. What is the difference between a compiler and an interpreter? Which does Java use? Why?
Compilers and interpreters both translate source code. A compiler translates the entire
program at once, then executes it. An interpreter, translates one statement, executes it,
translates the next statement, executes it, and so on.
Interpreted programs can start running faster – as soon as one statement is translated.
However, to run the program a second time, or to repeat a group of instructions, the
whole interpretation must take place again.
Compiled programs run faster, after the initial time is taken translate the whole program.
When a compiled program is run the second time, or a group of instructions is repeated,
it is very fast, because it is already compiled.
When a language is interpreted, the interpreter must be loaded into memory while the
, lOMoAR cPSD| 14985576
program runs, so there is less space available during execution. A compiler must only be
in memory when the program is being compiled.
Unlike other compiled languages that produce machine code for a specific computer, the
Java compiler produces bytecode that is not machine dependent. Any computer that has
the Java interpreter(The Java Virtual Machine) installed can read and understand the
bytecode.
3. What are the conventions for naming classes and variables in Java? What are the
advantages to using these conventions?
Class and variable names can have no embedded spaces and cannot be reserved words.
By convention, classes start with an uppercase letter and variables start with a lowercase
one. Following coding conventions helps the programmer stay organized. Additionally,
those who read the program have a clearer sense of the programmer’s intentions.
4. Can you store two public Java classes in the same file? How do you know?
No, because a filename must match the name of the class it contains.
Up for Discussion
1. Have you written programs in any programming language before starting this book?
If so, what do you think the advantages and disadvantages of using Java will be? If not, how
difficult do you think writing programs will be compared to other new skills you have
mastered?
Student answers will vary. Advantages of Java include being object-oriented and useful
for Web applications. Disadvantages include being less English-like than some other
languages.
2. Using the Web, try to discover which computer game is the most popular one ever
sold. Have you played this game? Would you like to? What makes this game so appealing?
Many Web sites provide different answers to what is the best selling or most popular
game, partially because games run on so many different platforms. Certainly, the families
of games featuring the Sims, Mario Brothers, and Halo are among the biggest
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller danieh. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $18.39. You're not tied to anything after your purchase.