Java eLearning Kit For Dummies
Published by
John Wiley & Sons, Inc.
111 River Street
Hoboken, NJ 07030-5774
www.wiley.com
Copyright 2014 by John Wiley & Sons, Inc., Hoboken, New Jersey
Published by John Wiley & Sons, Inc., Hoboken, New Jersey
Published simultaneously in Canada
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions
.
Trademarks: Wiley, the Wiley logo, For Dummies, the Dummies Man logo, A Reference for the Rest of Us!, The Dummies Way, Dummies Daily, The Fun and Easy Way, Dummies.com, Making Everything Easier, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates in the United States and other countries, and may not be used without written permission. Java is a registered trademark of Oracle America, Inc. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc. is not associated with any product or vendor mentioned in this book.
LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY : THE PUBLISHER AND THE AUTHOR MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR PROMOTIONAL MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY SITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL PERSON SHOULD BE SOUGHT. NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM. THE FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE. FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ.
For general information on our other products and services, please contact our Customer Care Department within the U.S. at 877-762-2974, outside the U.S. at 317-572-3993, or fax 317-572-4002.
For technical support, please visit www.wiley.com/techsupport
.
Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media such as a CD or DVD that is not included in the version you purchased, you may download this material at http://booksupport.wiley.com
. For more information about Wiley products, visit www.wiley.com
.
Library of Congress Control Number:
ISBN 978-1-118-09878-3 (pbk); ISBN 978-1-118-22370-3 (ebk); 978-1-118-23706-9 (ebk);
ISBN 978-1-118-26201-6 (ebk)
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
Chapter 1
Starting With Java
- Javas increasing popularity makes it the most common language used to develop cross-platform applications.
- Developers rely on the fact that Java is a standards-based language.
- Each platform that Java supports has its own version of the Java Software Development Kit (SDK) and Java Runtime Engine (JRE), yet uses precisely the same language.
- All Java applications share common components.
- Java applications rely on a special application called a compiler to change Java source code that the developer understands to an executable form that the JRE understands.
- Use comments to make it easier to remember what tasks your application performs.
- Java applications rely on the Java Application Programming Interface (API) to perform many tasks.
- Develop a better understanding of Java by viewing the help files.
- What are the advantages of using a language that works across multiple platforms?
Cross-platform compatibility is a major advantage of using Java, as described on page
- Where can I obtain a copy of the Java SDK?
You can find the installation and configuration instructions for the Java SDK starting on page
- Do I absolutely have to use an Integrated Development Environment (IDE)?
Java makes it quite easy to use a simple text editor to create programs, but youll do much better if you rely on an IDE as described on page
- What are the main parts of a Java application?
You can find a description of the major parts on page
- What purpose does the
.class
file serve?A .class
file contains the byte code executed by the JRE as described on page
- Why is the JavaW command important?
Discover the JavaW difference on page
- When should I comment my code?
There are distinct times when you should consider commenting your code, as explained on page
- Where do I find an explanation of the Java API content?
The Java API contains all the standard classes used to create applications, and you can find out about it on page
- Must I go online to get help?
Java provides both local and online help, as described on page
Java is an amazing language. Most programming languages are designed around a single operating system or environment. For example, when you work with the Microsoft .NET Framework languages, such as C# or Visual Basic, youre working with Windows unless you get a special third-party product to make these languages work elsewhere. Likewise, Macintosh developers commonly use Objective C to create their applications. Using PHP means that youre creating applications that appear in a browser, rather than applications that run within the host operating system. Java crosses all these boundaries. You can find Java running on just about every operating system, and Java applications can run both within the operating system environment and as part of a browser presentation.
LINGO
Java programmers use the Java Software Development Kit (SDK) to gain access to Java features, such as the ability to display information on screen or to work with files. To make the process of writing applications as easy as possible, the programmer uses an Integrated Development Environment (IDE) to write code. The IDE provides special help, such as reminding you about the Java features you can access as you type and finding errors in your code. After the programmer finishes writing an application, the source code is compiled into a
Next page