Beginning Programming with Java For Dummies

For Dummies (Verlag)
  • 5. Auflage
  • |
  • erschienen am 28. Juni 2017
  • |
  • 552 Seiten
E-Book | ePUB mit Adobe DRM | Systemvoraussetzungen
978-1-119-23556-9 (ISBN)
Learn to speak the Java language like the pros
Are you new to programming and have decided that Java is your language of choice? Are you a wanna-be programmer looking to learn the hottest lingo around? Look no further! Beginning Programming with Java For Dummies, 5th Edition is the easy-to-follow guide you'll want to keep in your back pocket as you work your way toward Java mastery! In plain English, it quickly and easily shows you what goes into creating a program, how to put the pieces together, ways to deal with standard programming challenges, and so much more.
Whether you're just tooling around or embarking on a career, this is the ideal resource you'll turn to again and again as you perfect your understanding of the nuances of this popular programming language. Packed with tons of step-by-step instruction, this is the only guide you need to start programming with Java like a pro.
* Updated for Java 9, learn the language with samples and the Java toolkit
* Familiarize yourself with decisions, conditions, statements, and information overload
* Differentiate between loops and arrays, objects and classes, methods, and variables
* Find links to additional resources
Once you discover the joys of Java programming, you might just find you're hooked. Sound like fun? Here's the place to start.
5. Auflage
  • Englisch
  • New York
  • |
  • USA
John Wiley & Sons
  • 9,24 MB
978-1-119-23556-9 (9781119235569)
1-119-23556-1 (1119235561)
weitere Ausgaben werden ermittelt
Barry Burd, PhD, has been a professor in the Department of Mathematics and Computer Science at Drew University since 1980. He has lectured at conferences in the United States, Europe, Australia, and Asia, and hosts podcasts on various software and technology topics. Dr. Burd also authored Java Programming for Android Developers For Dummies.
  • Intro
  • Title Page
  • Copyright Page
  • Table of Contents
  • Introduction
  • About This Book
  • How to Use This Book
  • Conventions Used in This Book
  • What You Don't Have to Read
  • Foolish Assumptions
  • How This Book Is Organized
  • Part 1: Getting Started with Java Programming
  • Part 2: Writing Your Own Java Programs
  • Part 3: Controlling the Flow
  • Part 4: Using Program Units
  • Part 5: The Part of Tens
  • Icons Used in This Book
  • Beyond the Book
  • Where to Go from Here
  • Part 1 Getting Started with Java Programming
  • Chapter 1 Getting Started
  • What's It All About?
  • Telling a computer what to do
  • Pick your poison
  • From Your Mind to the Computer's Processor
  • Translating your code
  • Running code
  • Code you can use
  • Your Java Programming Toolset
  • A tool for creating code
  • What's already on your hard drive?
  • Chapter 2 Setting Up Your Computer
  • If You Don't Like Reading Instructions . . .
  • Getting This Book's Sample Programs
  • Setting Up Java
  • Downloading and installing Java
  • If you want to find Java on your computer . . .
  • Setting Up the Eclipse Integrated Development Environment
  • Downloading Eclipse
  • Installing Eclipse
  • Running Eclipse for the first time
  • Importing This Book's Sample Programs
  • What's Next?
  • Chapter 3 Running Programs
  • Running a Canned Java Program
  • Typing and Running Your Own Code
  • Separating your programs from mine
  • Writing and running your program
  • What's All That Stuff in Eclipse's Window?
  • Understanding the big picture
  • Views, editors, and other stuff
  • What's inside a view or an editor?
  • Returning to the big picture
  • Part 2 Writing Your Own Java Programs
  • Chapter 4 Exploring the Parts of a Program
  • Checking Out Java Code for the First Time
  • Behold! A program!
  • What the program's lines say
  • The Elements in a Java Program
  • Keywords
  • Identifiers that you or I can define
  • Identifiers with agreed-upon meanings
  • Literals
  • Punctuation
  • Comments
  • Understanding a Simple Java Program
  • What is a method?
  • The main method in a program
  • How you finally tell the computer to do something
  • The Java class
  • Chapter 5 Composing a Program
  • Computers Are Stupid
  • A Program to Echo Keyboard Input
  • Typing and running a program
  • How the EchoLine program works
  • Getting numbers, words, and other things
  • Type three lines of code and don't look back
  • Expecting the Unexpected
  • Diagnosing a problem
  • What problem? I don't see a problem
  • Chapter 6 Using the Building Blocks: Variables, Values, and Types
  • Using Variables
  • Using a variable
  • Understanding assignment statements
  • To wrap or not to wrap?
  • What Do All Those Zeros and Ones Mean?
  • Types and declarations
  • What's the point?
  • Reading Decimal Numbers from the Keyboard
  • Though these be methods, yet there is madness in 't
  • Methods and assignments
  • Variations on a Theme
  • Moving variables from place to place
  • Combining variable declarations
  • Experimenting with JShell
  • Launching the JShell program
  • Using JShell
  • Chapter 7 Numbers and Types
  • Using Whole Numbers
  • Reading whole numbers from the keyboard
  • What you read is what you get
  • Creating New Values by Applying Operators
  • Finding a remainder
  • The increment and decrement operators
  • Assignment operators
  • Size Matters
  • Chapter 8 Numbers? Who Needs Numbers?
  • Characters
  • I digress . . .
  • One character only, please
  • Variables and recycling
  • When not to reuse a variable
  • Reading characters
  • The boolean Type
  • Expressions and conditions
  • Comparing numbers
  • comparing characters
  • The Remaining Primitive Types
  • Part 3 Controlling the Flow
  • Chapter 9 Forks in the Road
  • Decisions, Decisions!
  • Making Decisions (Java if Statements)
  • Looking carefully at if statements
  • A complete program
  • Indenting if statements in your code
  • Variations on the Theme
  • . . . Or else what?
  • Packing more stuff into an if statement
  • Some handy import declarations
  • Chapter 10 Which Way Did He Go?
  • Forming Bigger and Better Conditions
  • Combining conditions: An example
  • When to initialize?
  • More and more conditions
  • Using boolean variables
  • Mixing different logical operators together
  • Using parentheses
  • Building a Nest
  • Nested if statements
  • Cascading if statements
  • Enumerating the Possibilities
  • Creating an enum type
  • Using an enum type
  • Chapter 11 How to Flick a Virtual Switch
  • Meet the switch Statement
  • The cases in a switch statement
  • The default in a switch statement
  • Picky details about the switch statement
  • To break or not to break
  • Using Fall-Through to Your Advantage
  • Using a Conditional Operator
  • Chapter 12 Around and Around It Goes
  • Repeating Instructions over and over Again (Java while Statements)
  • Following the action in a loop
  • No early bailout
  • Thinking about Loops (What Statements Go Where)
  • Finding some pieces
  • Assembling the pieces
  • Getting values for variables
  • From infinity to affinity
  • Thinking about Loops (Priming)
  • Working on the problem
  • Fixing the problem
  • Chapter 13 Piles of Files: Dealing with Information Overload
  • Running a Disk-Oriented Program
  • A sample program
  • Creating code that messes with your hard drive
  • Running the sample program
  • Troubleshooting problems with disk files
  • Writing a Disk-Oriented Program
  • Reading from a file
  • Writing to a file
  • Writing, Rewriting, and Rerewriting
  • Chapter 14 Creating Loops within Loops
  • Paying Your Old Code a Little Visit
  • Reworking some existing code
  • Running your code
  • Creating Useful Code
  • Checking for the end of a file
  • How it feels to be a computer
  • Why the computer accidentally pushes past the end of the file
  • Solving the problem
  • Chapter 15 The Old Runaround
  • Repeating Statements a Certain Number of Times (?Java for Statements)
  • The anatomy of a for statement
  • Initializing a for loop
  • Using Nested for Loops
  • Repeating Until You Get What You Need (Java do Statements)
  • Getting a trustworthy response
  • Deleting a file
  • Using Java's do statement
  • A closer look at the do statement
  • Repeating with Predetermined Values (Java's Enhanced for Statement)
  • Creating an enhanced for loop
  • Nesting the enhanced for loops
  • Chapter 16 Using Loops and Arrays
  • Some Loops in Action
  • Deciding on a loop's limit at runtime
  • Using all kinds of conditions in a for loop
  • Reader, Meet Arrays
  • Arrays, Meet the Reader
  • Storing values in an array
  • Creating a report
  • Initializing an array
  • Working with Arrays
  • Looping in Style
  • Deleting Several Files
  • Part 4 Using Program Units
  • Chapter 17 Programming with Objects and Classes
  • Creating a Class
  • Reference types and Java classes
  • Using a newly defined class
  • Running code that straddles two separate files
  • Why bother?
  • From Classes Come Objects
  • Understanding (or ignoring) the subtleties
  • Making reference to an object's parts
  • Creating several objects
  • Another Way to Think about Classes
  • Classes, objects, and tables
  • Some questions and answers
  • What's Next?
  • Chapter 18 Using Methods and Fields from a Java Class
  • The String Class
  • A simple example
  • Putting String variables to good use
  • Reading and writing strings
  • Using an Object's Methods
  • Comparing strings
  • The truth about classes and methods
  • Calling an object's methods
  • Combining and using data
  • Static Methods
  • Calling static and non-static methods
  • Turning strings into numbers
  • Turning numbers into strings
  • How the NumberFormat works
  • Your country
  • your currency
  • Understanding the Big Picture
  • Packages and import declarations
  • Shedding light on the static darkness
  • Barry makes good on an age-old promise
  • Chapter 19 Creating New Java Methods
  • Defining a Method within a Class
  • Making a method
  • Examining the method's header
  • Examining the method's body
  • Calling the method
  • The flow of control
  • Using punctuation
  • The versatile plus sign
  • Let the Objects Do the Work
  • Passing Values to Methods
  • Handing off a value
  • Working with a method header
  • How the method uses the object's values
  • Passing more than one parameter
  • Getting a Value from a Method
  • An example
  • How return types and return values work
  • Working with the method header (again)
  • Chapter 20 Oooey GUI Was a Worm
  • The Java Swing Classes
  • Showing an image on the screen
  • Just another class
  • The Swing Classes: Round 2
  • Extending a class
  • Code Soup: Mixing XML with Java
  • Using JavaFX and Scene Builder
  • Installing Scene Builder
  • Installing e(fx)clipse
  • Creating a bare-bones JavaFX project
  • Running your bare-bones JavaFX project
  • Adding Stuff to Your JavaFX Project
  • Taking Action
  • Part 5 The Part of Tens
  • Chapter 21 Ten Websites for Java
  • This Book's Website
  • The Horse's Mouth
  • Finding News, Reviews, and Sample Code
  • Looking for Java Jobs
  • Got a Question?
  • Chapter 22 Ten Useful Classes in the Java API
  • ArrayList
  • File
  • Integer
  • JFrame
  • JOptionPane
  • Math
  • NumberFormat
  • Scanner
  • String
  • System
  • Index
  • EULA


What's your story?

  • Are you a working stiff, interested in knowing more about the way your company's computers work?
  • Are you a student who needs some extra reading in order to survive a beginning computer course?
  • Are you a typical computer user - you've done lots of word processing and you want to do something more interesting with your computer?
  • Are you a job seeker with an interest in entering the fast-paced, glamorous, high-profile world of computer programming (or, at least, the decent-paying world of computer programming)?

Well, if you want to write computer programs, this book is for you. This book avoids the snobby "of-course-you-already-know" assumptions and describes computer programming from scratch.

About This Book

The book uses Java - a powerful, general-purpose computer programming language. But Java's subtleties and eccentricities aren't the book's main focus. Instead, this book emphasizes a process - the process of creating instructions for a computer to follow. Many highfalutin books describe the mechanics of this process - the rules, the conventions, and the formalisms. But those other books aren't written for real people. Those books don't take you from where you are to where you want to be.

In this book, I assume very little about your experience with computers. As you read each section, you get to see inside my head. You see the problems that I face, the things that I think, and the solutions that I find. Some problems are the kind that I remember facing when I was a novice; other problems are the kind that I face as an expert. I help you understand, I help you visualize, and I help you create solutions on your own. I even get to tell a few funny stories.

How to Use This Book

I wish I could say, "Open to a random page of this book and start writing Java code. Just fill in the blanks and don't look back." In a sense, this is true. You can't break anything by writing Java code, so you're always free to experiment.

But I have to be honest: If you don't understand the bigger picture, writing a program is difficult. That's true with any computer programming language - not just Java. If you're typing code without knowing what it's about, and the code doesn't do exactly what you want it to do, you're just plain stuck.

In this book, I divide programming into manageable chunks. Each chunk is (more or less) a chapter. You can jump in anywhere you want - Chapter 5, Chapter 10, or wherever. You can even start by poking around in the middle of a chapter. I've tried to make the examples interesting without making one chapter depend on another. When I use an important idea from another chapter, I include a note to help you find your way around.

In general, my advice is as follows:

  • If you already know something, don't bother reading about it.
  • If you're curious, don't be afraid to skip ahead. You can always sneak a peek at an earlier chapter, if you really need to do so.

Conventions Used in This Book

Almost every technical book starts with a little typeface legend, and Beginning Programming with Java For Dummies, 5th Edition, is no exception. What follows is a brief explanation of the typefaces used in this book:

  • New terms are set in italics.
  • When I want you to type something short or perform a step, I use bold.
  • You'll also see this computerese font. I use the computerese font for Java code, filenames, web page addresses (URLs), onscreen messages, and other such things. Also, if something you need to type is really long, it appears in computerese font on its own line (or lines).
  • You need to change certain things when you type them on your own computer keyboard. For example, I may ask you to type

    class Anyname

    which means you should type class and then a name that you make up on your own. Words that you need to replace with your own words are set in italicized computerese.

What You Don't Have to Read

Pick the first chapter or section that has material you don't already know and start reading there. Of course, you may hate making decisions as much as I do. If so, here are some guidelines you can follow:

  • If you already know what computer programming is all about, skip the first half of Chapter 1. Believe me, I won't mind.
  • If you're required to use a development environment other than Eclipse, you can skip Chapter 2. This applies if you plan to use NetBeans, IntelliJ IDEA, or a number of other development environments.

    Most of this book's examples require Java 5.0 or later, and some of the examples require Java 7 or later. So make sure that your system uses Java 7 or later. If you're not sure about your computer's Java version or if you have leeway in choosing a development environment, your safest move is to read Chapter 3.

  • If you've already done a little computer programming, be prepared to skim Chapters 6, 7, and 8. Dive fully into Chapter 9 and see whether it feels comfortable. (If so, read on. If not, skim Chapters 6, 7, and 8 again.)
  • If you feel comfortable writing programs in a language other than Java, this book isn't for you. Keep this book as a memento and buy my Java For Dummies, 7th Edition (also published by Wiley).

If you want to skip the sidebars and the material highlighted by a Technical Stuff icon, please do. In fact, if you want to skip anything at all, feel free.

Foolish Assumptions

In this book, I make a few assumptions about you, the reader. If one of these assumptions is incorrect, you're probably okay. If all these assumptions are incorrect . well, buy the book anyway.

  • I assume that you have access to a computer. Here's good news. You can run the code in this book on almost any computer. The only computers you can't use to run this code are ancient things that are more than eight years old (give or take a few years). You can run the latest version of Java on Windows, Macintosh, and Linux computers.
  • I assume that you can navigate your computer's common menus and dialog boxes. You don't have to be a Windows, Linux, or Macintosh power user, but you should be able to start a program, find a file, put a file into a certain directory - that sort of thing. Most of the time, when you practice the stuff in this book, you're typing code on your keyboard, not pointing and clicking the mouse.

    On those rare occasions when you need to drag and drop, cut and paste, or plug and play, I guide you carefully through the steps. But your computer may be configured in any of several billion ways, and my instructions may not quite fit your special situation. So when you reach one of these platform-specific tasks, try following the steps in this book. If the steps don't quite fit, send me an email message or consult a book with instructions tailored to your system.

  • I assume that you can think logically. That's all there is to computer programming - thinking logically. If you can think logically, you've got it made. If you don't believe that you can think logically, read on. You may be pleasantly surprised.
  • I assume that you know little or nothing about computer programming. This isn't one of those "all things to all people" books. I don't please the novice while I tease the expert. I aim this book specifically toward the novice - the person who has never programmed a computer or has never felt comfortable programming a computer. If you're one of these people, you're reading the right book.

How This Book Is Organized

This book is divided into subsections, which are grouped into sections, which come together to make chapters, which are lumped finally into five parts. (When you write a book, you get to know your book's structure pretty well. After months of writing, you find yourself dreaming in sections and chapters when you go to bed at night.) The parts of the book are listed here.

Part 1: Getting Started with Java Programming

The chapters in Part 1 prepare you for the overall programming experience. In these chapters, you find out what programming is all about and get your computer ready for writing and testing programs.

Part 2: Writing Your Own Java Programs

This part covers the basic building blocks - the elements in any Java program and in any program written using a Java-like language. In this part, you discover how to represent data and how to get new values from existing values. The program examples are short, but cute.

Part 3: Controlling the Flow

Part 3 has some of my favorite chapters. In these chapters, you make the computer navigate from one part of your program to another. Think of your program as a big mansion, with the computer moving from room to room. Sometimes the computer chooses between two or more hallways, and sometimes the computer revisits rooms. As a...

Dateiformat: EPUB
Kopierschutz: Adobe-DRM (Digital Rights Management)


Computer (Windows; MacOS X; Linux): Installieren Sie bereits vor dem Download die kostenlose Software Adobe Digital Editions (siehe E-Book Hilfe).

Tablet/Smartphone (Android; iOS): Installieren Sie bereits vor dem Download die kostenlose App Adobe Digital Editions (siehe E-Book Hilfe).

E-Book-Reader: Bookeen, Kobo, Pocketbook, Sony, Tolino u.v.a.m. (nicht Kindle)

Das Dateiformat EPUB ist sehr gut für Romane und Sachbücher geeignet - also für "fließenden" Text ohne komplexes Layout. Bei E-Readern oder Smartphones passt sich der Zeilen- und Seitenumbruch automatisch den kleinen Displays an. Mit Adobe-DRM wird hier ein "harter" Kopierschutz verwendet. Wenn die notwendigen Voraussetzungen nicht vorliegen, können Sie das E-Book leider nicht öffnen. Daher müssen Sie bereits vor dem Download Ihre Lese-Hardware vorbereiten.

Weitere Informationen finden Sie in unserer E-Book Hilfe.

Download (sofort verfügbar)

20,99 €
inkl. 19% MwSt.
Download / Einzel-Lizenz
ePUB mit Adobe DRM
siehe Systemvoraussetzungen
E-Book bestellen