Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
59Activity
0 of .
Results for:
No results containing your search query
P. 1
Java Programming

Java Programming

Ratings:

4.0

(1)
|Views: 869|Likes:
Published by api-3702997

More info:

Published by: api-3702997 on Oct 14, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

03/18/2014

pdf

text

original

Chapter 1
How to get started with Java
1
Section 1
The essence of
Java programming

The best way to learn Java programming is to start doing it, and that\u2019s the
approach the chapters in this section take. So in chapter 1, you get started right
as you learn how to get Java on your system and how to compile and run Java
programs. Then, in chapters 2 and 3, you learn how to use the Java language
essentials as you write your first Java applications. At this point, you\u2019re using
some of the basic Java classes and objects, but you\u2019re not writing object-
oriented programs.

To develop programs the way the professionals do, however, you need to
write object-oriented programs. So that\u2019s what you\u2019ll learn how to do in the
next two chapters. In chapter 4, you learn how to write programs that consist
of two or more classes. In chapter 5, you are introduced to all of the object-
oriented concepts and skills that you need as you work with Java. These are
useful as you create and use your own classes and objects, and they are
absolutely essential for making effective use of the hundreds of classes that
Java provides.

Before you can write an effective object-oriented program, though, you
need to know how to design and test an object-oriented program. So that\u2019s
what you\u2019ll learn to do in the last chapter of this section. When you complete
it, you\u2019ll have the essential skills that you need for designing, coding, and
testing object-oriented Java programs. You\u2019ll also have a clear view of what
Java programming is and what you have to do to become proficient at it. That\u2019s
why we call this section \u201cThe essence of Java programming.\u201d

Mike Murach & Associates
2560 West Shaw Lane, Suite 101
Fresno, CA 93711-2765
(559) 440-9071\u2022 (800) 221-5528
murachbooks@murach.com\u2022 www.murach.com
Copyright \u00a9 2002 Mike Murach & Associates. All rights reserved.
Chapter 1
How to get started with Java
3
1
How to get started with
Java

Before you can begin learning the Java language, you need to install Java and you need to learn how to use some tools for working with Java. So that\u2019s what you\u2019ll learn in this chapter. Along the way, you\u2019ll be introduced to some of the concepts and terms you need for working with Java.

Introduction to Java.............................................................. 4

Toolkits and platforms..................................................................................... 4 Java compared to C++.................................................................................... 4 Applications, applets, and servlets................................................................. 6 How Java compiles and interprets code.......................................................... 8

How to get Java on your system....................................... 10

How to install the SDK................................................................................. 10 A summary of the directories and files of the SDK..................................... 12 How to configure Windows to work with the SDK...................................... 14

How to use Windows tools to work with Java.................. 16

How to use Notepad to save and edit source code........................................ 16 How to use the DOS prompt to compile source code.................................. 18 How to use the DOS prompt to run an application...................................... 18 Common error messages and solutions........................................................ 20 Essential DOS skills for working with Java................................................. 22

How to use TextPad to work with Java.............................. 24

How to use TextPad to save and edit source code........................................ 24 How to use TextPad to compile source code................................................ 26 How to use TextPad to run an application.................................................... 26

Introduction to Java IDEs................................................... 28
Why we don\u2019t recommend using an IDE when you\u2019re learning Java.......... 28
Why we recommend using an IDE once you\u2019ve mastered Java................... 28
Perspective.......................................................................... 30
4
Section 1
The essence of Java programming
Introduction to Java

In 1996, Sun Microsystems released a new programming language called
Java. This language had some unique features that gave it great promise as a
language that could be used on all platforms for all types of applications. In the
three figures that follow, you\u2019ll learn more about this language, its features, and its
applications.

Toolkits and platforms

Figure 1-1 describes all major releases of Java to date starting with version
1.0 and ending with version 1.4. As you can see, Sun referred to versions 1.0 and
1.1 of the Java toolkit as the Java Development Kit (JDK). With version 1.2,
however, Sun began using the term Software Development Kit (SDK) to describe
the Java toolkit. In practice, these two terms are often used interchangeably. In
this book, we\u2019ll use the termS D K since it\u2019s the most current term.

All versions of the SDK since version 1.2 are referred to as Java 2 because
they all run under the Java 2 Platform. This book will show you how to use the
Java 2 Platform, Standard Edition(J2SE). Once you master the Standard Edition,
you will have all the skills you need to begin learning how to use the Java 2
Platform, Enterprise Edition(J2EE). In fact, many of the same skills apply to
both editions.

One reason that Java has become so widely used is that it can create programs
that can run on any of the operating systems shown in this figure. In addition, Java
programs can also be run under the Macintosh operating system. You\u2019ll learn
more about the details of how this works later in this chapter.

Java compared to C++

When Sun\u2019s developers created Java, they tried to keep the syntax for Java
similar to the syntax for Microsoft C++ so it would be easy for C++ programmers
to learn Java. That\u2019s one of the four features that are used for comparing Java and
C++ in this figure.

The second feature is one of the most touted Java features. Specifically, Java is designed so its applications can be run on any computer platform. In contrast, C++ needs to have a specific compiler for each platform that its applications are going to run on. You\u2019ll learn more about this in figure 1-3.

The third feature, though, indicates one of the weaknesses of Java. Specifi-
cally, the speed (or performance) of its applications is often considerably slower
than the speed of traditional applications. In fact, this is an issue that limits the use
of Java for some types of applications.

The fourth feature has to do with the use of internal memory. Specifically, Java is easier to use than C++ because it handles many operations involving the creation and destruction of memory automatically. This also makes it easier to write bug-free code.

Activity (59)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
Ana Rodrigues liked this
adamnevski liked this
Mathew Chacko liked this
Eddy liked this
syriluit liked this
Zaa Ramley liked this
bolubej liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->