1. Trang chủ
  2. » Công Nghệ Thông Tin

Learn java the easy way a hands on introduction to programming covers java 8 and 9

305 253 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

LEARN JAVA THE EASY WAY LEARN JAVA THE EASY WAY A Hands-On Introduction to Programming Bryson Payne San Francisco LEARN JAVA THE EASY WAY Copyright © 2018 by Bryson Payne All rights reserved No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher ISBN-10: 1-59327-805-5 ISBN-13: 978-1-59327-805-2 Publisher: William Pollock Production Editor: Riley Hoffman Cover Illustration: Josh Ellingson Interior Design: Octopod Studios Developmental Editors: Jan Cash and Tyler Ortman Technical Reviewer: Bryan Fagan Copyeditor: Rachel Monaghan Compositors: Riley Hoffman and Meg Sneeringer Proofreader: Paula L Fleming Indexer: BIM Creatives, LLC For information on distribution, translations, or bulk sales, please contact No Starch Press, Inc directly: No Starch Press, Inc 245 8th Street, San Francisco, CA 94103 phone: 1.415.863.9900; sales@nostarch.com www.nostarch.com Library of Congress Cataloging-in-Publication Data Names: Payne, Bryson, author Title: Learn Java the easy way : a hands-on introduction to programming / Bryson Payne Description: San Francisco : No Starch Press, Inc., [2018] Identifiers: LCCN 2017022283 (print) | LCCN 2017035701 (ebook) | ISBN 9781593278465 (epub) | ISBN 1593278462 (epub) | ISBN 9781593278052 (pbk.) | ISBN 1593278055 (pbk.) Subjects: LCSH: Java (Computer program language) | Java (Computer program language) Classification: LCC QA76.73.J38 (ebook) | LCC QA76.73.J38 P3955 2018 (print) | DDC 005.13/3 dc23 LC record available at https://lccn.loc.gov/2017022283 No Starch Press and the No Starch Press logo are registered trademarks of No Starch Press, Inc Other product and company names mentioned herein may be the trademarks of their respective owners Rather than use a trademark symbol with every occurrence of a trademarked name, we are using the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark The information in this book is distributed on an “As Is” basis, without warranty While every precaution has been taken in the preparation of this work, neither the author nor No Starch Press, Inc shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in it About the Author Dr Bryson Payne is a tenured professor of computer science at the University of North Georgia, where he has taught aspiring coders since 1998 He is a Certified Information Systems Security Professional (CISSP) and Certified Ethical Hacker (CEH), among other industry certifications He was also the first Department Head of Computer Science at UNG and the founding Director of the Center for Cyber Operations Education, an NSA Center of Academic Excellence in Cyber Defense He enjoys working with K–12 schools worldwide to promote computer science education Featured in CIO magazine, Campus Technology , and the Wall Street Journal , Dr Payne is also the best-selling author of Teach Your Kids to Code: A Parent-Friendly Guide to Python Programming (No Starch Press, 2015), now published in five languages (Korean, Portuguese, Russian, Chinese, and English) He’s also a popular online instructor of several courses, including the highly rated Udemy course Real-World Ethical Hacking (2017) His courses reach more than 20,000 enrolled students from more than 150 countries He holds a PhD in computer science from Georgia State University and has published articles in scholarly and trade journals, in addition to speaking regularly at regional and national conferences on computer science and cybersecurity education Dr Payne lives north of Atlanta, Georgia, with his lovely wife, Bev; two sons, Alex and Max; and three cats, Leo, Rocky, and Pixel About the Technical Reviewer Bryan Fagan is a middle school engineering and technology teacher He lives in Dahlonega, Georgia, where he teaches, enjoys the slow-rolling Appalachian mountains with his wife and daughter, and trains in Brazilian jiujitsu He is the founder of Make Stuff, an after-school makerspace for middle school students To Mom, for always believing in me BRIEF CONTENTS Acknowledgments Introduction Chapter 1: Getting Started Chapter 2: Build a Hi-Lo Guessing Game App! Chapter 3: Creating a GUI for Our Guessing Game Chapter 4: Creating Your First Android App Chapter 5: Polishing Your App by Adding Menus and Preferences Chapter 6: Deciphering Secret Messages Chapter 7: Creating Advanced GUIs and Sharing Your App Chapter 8: Make Secret Messages a Phone App to Share with Friends! Chapter 9: Paint Colorful Bubbles with Your Mouse! Chapter 10: Adding Animation and Collision Detection with Timers Chapter 11: Making BubbleDraw a Multitouch Android App Appendix: Debugging and Avoiding Common Errors in Java Index CONTENTS IN DETAIL ACKNOWLEDGMENTS INTRODUCTION Why Should I Learn to Code? Why Should I Learn Java? What’s in This Book What Tools Do I Need? Online Resources Start Now! GETTING STARTED Java on Windows, macOS, and Linux Installing Java and for Developers Installing the Eclipse IDE for Java Developers Setting Up Eclipse Installing the WindowBuilder Editor Customizing Eclipse’s Look and Feel Installing Android Studio for Mobile App Development Getting to Know Java with JShell Running JShell Working with Java Expressions in JShell Declaring Java Variables in JShell Printing Output in Java JShell Commands What You Learned BUILD A HI-LO GUESSING GAME APP! Planning the Game Step-by-Step Creating a New Java Project Creating the HiLo Class Generating a Random Number Getting User Input from the Keyboard Making the Program Print Output Loops: Ask, Check, Repeat if Statements: Testing for the Right Conditions Adding a Play Again Loop Testing the Game What You Learned Programming Challenges #1: Expanding Your Range #2: Counting Tries #3: Playing MadLibs CREATING A GUI FOR OUR GUESSING GAME Practicing with JShell Creating a GUI in Four Lines of Code Creating an Interactive GUI in 10 Lines of Code! Setting Up the GUI App in Eclipse GUI Design with Eclipse’s WindowBuilder Editor Designing the User Interface Setting GUI Properties in the Properties Pane Customizing GUI Components in the Palette Pane Aligning GUI Elements Naming GUI Components for Coding Connecting the GUI to Your Java Code Adding a Method to Check the Player’s Guess Getting Text from a JTextField Converting Strings to Numbers Starting a New Game Listening for User Events: Click to Guess! Setting Up the GUI Window Time to Play! Adding a Play Again Feature Improving the UX Allowing Users to Press Enter to Guess Automatically Removing Old Guesses Handling Bad User Input What You Learned Programming Challenges #1: Showing Users How Many Tries They Took #2: Showing and Hiding a Play Again Button #3: Creating a GUI MadLib CREATING YOUR FIRST ANDROID APP Starting a New Android Studio App Project JButton component, 46, 52, 54, 63, 74, 151, 232 JCheckBox component, 52 JDK (Java Development Kit), 2–3, 10 JFrame class, 44, 48–49, 199, 223 JLabel component, 52–54, 57, 61, 74, 151, 240 JOptionPane component, 164 JPanel component, 46, 198–199, 207–208, 232, 240 JRE (Java Runtime Environment) software, 1–2, 141 JScrollPane component, 173–174 JShell, commands, 16–17 creating GUIs in, 44–47 declaring Java variables in, 13–15 evaluating Java expressions in, 12–13 “Hello, Java!” test code, opening code in, 16 printing output, 15 running, 9–11 from command line, 10–11 confirming installed version of JDK, 10 from shortcut, 11–12 saving code created in, 16 starting new code snippets, 17 testing Java setup, 9–17 JShell Edit Pad, 46–47 JSlider component, 164–167 JTextArea component, 150–152 scroll bars for, 173–174 wrapping text, 162 JTextField component, 52–53, 56–57, 59–60, 68–69, 151–152 JVM (Java Virtual Machine) software, 1–2, 141 K key/value pairs, 118 L labels adding, 52–54, 81–82 alignment, 53 editing, 53, 81–82 font, 53 naming for coding, 56 length() method, 129–131 less-than operator (), 30, 60 less than (

Ngày đăng: 04/03/2019, 10:04

Xem thêm:

TỪ KHÓA LIÊN QUAN

Mục lục

    About the Technical Reviewer

    Why Should I Learn to Code?

    Why Should I Learn Java?

    What’s in This Book

    What Tools Do I Need?

    Java on Windows, macOS, and Linux

    Installing Java 8 and 9 for Developers

    Installing the Eclipse IDE for Java Developers

    Installing the WindowBuilder Editor

    Customizing Eclipse’s Look and Feel

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN