dummies logo
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
forward arrow
  • Custom Solutions
  • Dummies AI
    • Log In
    • dummies logo
      Articles

      Article Categories

      close
      TechnologyAcademics & The ArtsHome, Auto, & HobbiesBody, Mind, & SpiritBusiness, Careers, & Money
      Collections

      Collections

      Explore all collections
      close
      BYOB (Be Your Own Boss)Be a Rad DadCareer ShiftingContemplating the CosmosFor Those Seeking Peace of MindFor the Aspiring AficionadoFor the Budding Cannabis EnthusiastFor the College BoundFor the Exam-Season CrammerFor the Game Day Prepper
      Custom Solutions
      Dummies AI

      Beginning Programming with Java For Dummies

      Author:  
      Barry Burd
      Published:  
      September 28, 2021
      Buy on AmazonBuy on Wiley

      Overview

      Become a Java wizard with this popular programming guide

      Consider Beginning Programming with Java For Dummies your indispensable guide to learning how to program in one of the most popular programming languages—Java! Java is an invaluable language to master, as it's widely used for application development, including Android, desktop, and server-side applications.

      Beginning Programming with Java For Dummies is written specifically for newbies to programming. The book starts with an overview of computer programming and builds from there; it explains the software you need, walks you through writing your own programs, and introduces you to a few of the more-complex aspects of programming in Java. It also includes step-by-step examples you can try on your own (and email the author if you

      need help). As you work through the book, you'll get smart about these Java features:

      • Object-oriented programming (OOP), a Java mainstay
      • IntelliJ IDEA, an integrated development environment (IDE), that gives you one place to do all your programming, including debugging code
      • Loops, branches, and collections
      • Variables and operators
      • Expressions, statements, and blocks

      Beginning Programming with Java For Dummies translates all this foreign programming and computer syntax into plain English, along with plenty of helpful examples and tips. Learning a new language—and coding is definitely its own language—should be a fun endeavor. With this book as your handy interpreter, you’ll be on your way to fluency, speaking the language of coders everywhere!

      Show More
      Beginning Programming with Java For Dummies Cheat Sheet
      When doing anything with Java, you need to know your Java words — those programming words, phrases, and nonsense terms that have specific meaning in the Java language and that get it to do its thing. This cheat sheet walks you through Java's peculiar vocabulary by focusing on keywords, literals, restricted keywords and identifiers.

      About The Author

      Barry Burd, PhD holds an MS in Computer Science from Rutgers University and a PhD in Mathematics from the University of Illinois. Barry is the author of numerous For Dummies books, including Java For Dummies and Beginning Programming with Java For Dummies.

      Show More

      Have This Book?

      View Book Companion Site
      Access Practice Tests
      Additional Book Resources

      Articles From The Book

      36 results

      Java

       Articles

      A Few Things about Java GUIs
      Before you jump into Java GUIs, there are a few things you should know. Java comes with three sets of classes for creating GUI applications: The Abstract Window Toolkit (AWT): The original set of classes, dating back to JDK 1.0. Classes in this set belong to packages whose names begin with java.awt. Components in this set have names like Button, TextField, Frame, and so on.

      Java

       Articles

      A Quick Look at Java’s Disk Access Facilities
      Templates look very nice. But knowing how the templates work is even better. Here are a few tidbits describing the inner workings of Java’s disk access code: APrintStream is something you can use for writing output. A PrintStream is like a Scanner. The big difference is that a Scanner is for reading input and a PrintStream is for writing output.

      Java

       Articles

      Beginning Programming with Java For Dummies Cheat Sheet
      When doing anything with Java, you need to know your Java words — those programming words, phrases, and nonsense terms that have specific meaning in the Java language and that get it to do its thing. This cheat sheet walks you through Java's peculiar vocabulary by focusing on keywords, literals, restricted keywords and identifiers.

      Java

       Articles

      Creating Java Code that Messes with Your Hard Drive
      Experienced Java programmers have seen code that messes with your hard drive. But, what should you do with it? Let’s take a look.“I _____ (print your name)_____ agree to pay $______each month on the ___th day of the month.”Fill in the blanks. That’s all you have to do. Reading input from a disk can work the same way.

      Technology

       Articles

      Firing up IntelliJ IDEA
      Imagine that you’re expecting a delivery from a local confectioner. In the late afternoon, the mail carrier delivers a box containing your favorite chocolate candy. Naturally, you want to open the box as soon as it arrives.The same is true about this book’s software. Here’s how you open your newly downloaded IntelliJ IDEA box: Launch the IntelliJ IDEA application.

      Java

       Articles

      Getting Started with Java Programming
      The late 1980s saw several advances in software development, and by the early 1990s, many large programming projects were being written from prefab components. Java came along in 1995, so it was natural for the language's founders to create a library of reusable code. The library included about 250 programs, including code for dealing with disk files, code for creating windows, and code for passing information over the Internet.

      Java

       Articles

      Getting a Value from a Method in Java
      Say that you’re sending a friend to buy groceries. You make requests for groceries in the form of method calls. You issue calls such asgoToTheSupermarketAndBuySome(bread);goToTheSupermarketAndBuySome(bananas);The things in parentheses are parameters. Each time you call your goToTheSupermarketAndBuySome method, you put a different value in the method’s parameter list.

      Java

       Articles

      Grabbing Input for Your Java Programs
      The Java code you see below illustrates some pithy issues surrounding the input of data. For one thing, the program gets input from both the keyboard and a disk file. (The program gets a room number from the keyboard. Then the program gets the number of guests in that room from the occupancy file.) To make this happen, this program sports two Scanner declarations: one to declare keyboard and a second to declare diskScanner.

      Java

       Articles

      How to Generate Words Randomly in Java
      Most Java programs don’t work correctly the first time you run them, and some programs don’t work without extensive trial and error on your part. This code is a case in point.To write this code, you need a way to generate three-letter words randomly. This code would give you the desired result: anAccount.lastName = " + (char) (myRandom.

      Java

       Articles

      How to Install JavaFX and Scene Builder
      Before you can jump into Java GUIs, you need to install JavaFX and Scene Builder. GUI programs have two interesting characteristics: GUI programs typically contain lots of code. Much of this code differs little from one GUI program to another. GUI programs involve visual elements. The best way to describe visual elements is to “draw” them.

      Java

       Articles

      How to Put String Variables to Good Use in Java
      The Java program below takes the user’s input and echoes it back on the screen. This is a wonderful program, but (like many college administrators) it doesn’t seem to be particularly useful.Take a look at a more useful application of Java’s String type.import java.util.Scanner;import static java.lang.System.out; class ProcessMoreData { public static void main(String args[>) {Scanner keyboard = new Scanner(System.

      Java

       Articles

      How to Store Values in an Array in Java
      After you’ve created an array in Java, you can put values into the array’s components. For example, imagine you are the owner of a motel. The guests in Room 6 are fed up with all those mint candies that you put on peoples’ beds. They check out, and Room 6 becomes vacant. You should put the value 0 into the 6 component.

      Java

       Articles

      How to Use Cascading if Statements in Java
      Here’s a Java riddle: You have two baseball teams — the Hankees and the Socks. You want to display the teams’ scores on two separate lines, with the winner’s score listed first. (On the computer screen, the winner’s score is displayed above the loser’s score.) What happens when the scores are tied?Do you give up?

      Java

       Articles

      How to Use Java’s do Statement
      To write the Java program you see below, you need a loop — a loop that repeatedly asks the user whether the importantData.txt file should be deleted. The loop continues to ask until the user gives a meaningful response./** DISCLAIMER: Neither the author nor John Wiley & Sons,* Inc., nor anyone else even remotely connected with the* creation of this book, assumes any responsibility* for any damage of any kind due to the use of this code,* or the use of any work derived from this code,* including any work created partially or in full by* the reader.

      Java

       Articles

      How to Write Java Code to Show an Image on the Screen
      You will probably find times when programming with Java that you need to display a window on your computer screen. This code has very little logic of its own. Instead, this code pulls together a bunch of classes from the Java API. import javax.swing.JFrame; import javax.swing.ImageIcon; import javax.swing.JLabel; class ShowPicture { public static void main(String args[]) { var frame = new JFrame(); var icon = new ImageIcon("androidBook.

      Java

       Articles

      Identifiers in the Java API
      The Java API (Application Programming Interface) has thousands of identifiers. Each identifier is the name of something (a class, an object, a method, or something like that). These identifiers include System, out, println, String, toString, JFrame, File, Scanner, next, nextInt, Exception, close, ArrayList, stream, JTextField, Math, Random, MenuItem, Month, parseInt, Query, Rectangle, Color, Oval, paint, Robot, SQLData, Stack, Queue, TimeZone, URL, and so many others.

      Java

       Articles

      Java Identifiers That You (the Programmer) Declare
      In your own Java program, you can make up names to your heart's delight. For example, in the codedouble multiplyByTwo(double myValue) { return myValue * 2; }the names multiplyByTwo and myValue are your very own identifiers.When you create a new name, you can use letters, digits, underscores (_), and dollar signs ($).

      Java

       Articles

      Java Keywords
      The Java programming language has 50 keywords. Each keyword has a specific meaning in the language. You can't use a keyword for anything other than its pre-assigned meaning.The following table lists Java's keywords. Keyword What It Does abstract Indicates that the details of a class, a method, or an interface are given elsewhere in the code.

      Java

       Articles

      Java Literals
      In addition to its keywords, three of the words you use in a Java program are called literals. Each literal has a specific meaning in the language. You can't use a literal for anything other than its pre-assigned meaning.The following table lists Java's literal words. Literal What It Does false One of the two values that a boolean expression can possibly have.

      Java

       Articles

      Java Programming: Telling the Computer to Do Something
      In Listing 1, below, you get a blast of Java code. Like all novice programmers, you're expected to gawk humbly at the code. But don't be intimidated. When you get the hang of it, programming is pretty easy. Yes, it's fun, too.Listing 1: A Simple Java Program /* * A program to list the good things in life * Author: Barry Burd, BeginPro@allmycode.

      Java

       Articles

      Let the Objects Do the Work in Java
      When I was a young object, I wasn’t as smart as the objects you have nowadays. Consider, for example, the object in the code below This object not only displays itself, but it can also fill itself with values.importjava.util.Random;importjava.text.NumberFormat;import static java.lang.System.out; classBetterAccount {String lastName;int id;double balance;<strong> </strong><strong>void fillWithData() {</strong><strong>Random myRandom = new Random();</strong> <strong>lastName = "" +</strong><strong> </strong> <strong>(char) (myRandom.

      Java

       Articles

      Looping in Style: Enhanced for Loops to Step through Java’s Array Values
      You can make an enhanced for loop to step through a bunch of values, including an array’s values. Let’s take a look at an enhanced for loop that steps through an array’s values.To see such a loop, start with this code. The loop looks something like this:for (int roomNum = 0; roomNum < 10; roomNum++) {out.println(guestsIn[roomNum]);}To turn this into an enhanced for loop, you make up a new variable name.

      Java

       Articles

      Picky Details about the Java Switch Statement
      For Java programmers the switch statement can be a useful piece of code. But, there are a few things you should know before you use it. A switch statement can take the following form:switch (Expression) {case <em>FirstValue</em>:<em>Statements</em> case <em>SecondValue</em>:<em>MoreStatements</em> / ... more cases.

      Java

       Articles

      Possible Errors in Your Java Code
      Ridding the editor of jagged underlines is cause for celebration. Eclipse likes the look of your Java code, so from that point on, it's smooth sailing. Right?Well, it ain't necessarily so. In addition to some conspicuous compile-time errors, your code can have other, less obvious errors.Imagine someone telling you to “go to the intersection, and then rurn tight.

      Java

       Articles

      Randomness in Java
      When you call myRandom.nextInt(10) + 1 in Java, you get a number from 1 to 10. As a test, here’s a program that calls myRandom.nextInt(10) + 1Random myRandom=new Random();System.out.print(myRandom.nextInt(10) + 1);System.out.print(" ");System.out.print(myRandom.nextInt(10) + 1);System.out.print(" ");System.out.

      Java

       Articles

      Reading and Writing Strings in Java
      A String is a bunch of characters in Java. It’s like having several char values in a row. To read a String value from the keyboard, you can call either next or nextLine: The methodnextreads up to the next blank space. For example, with the input Barry A. Burd, the statementsString firstName = keyboard.next();String middleInit = keyboard.

      Java

       Articles

      Restricted Java Keywords
      With the release of Java 9, the language has ten new words called restricted keywords. A restricted keyword has a specific meaning in the language, but only if you use that word in a specific way. For example, if you writerequires other.stuff;you tell Java that your program won't run unless it has access to some other code (the code contained in other.

      Java

       Articles

      Saving Time and Money with Java Classes
      When you start learning object-oriented programming, you may think that this class idea is a big hoax. Some geeks in Silicon Valley had nothing better to do, so they went to a bar and made up some confusing gibberish about classes. They don’t know what it means, but they have fun watching people struggle to understand it.

      Java

       Articles

      Some Handy Java Import Declarations
      Do you ever get tired of writing the word System? This is a conundrum for Java programmers. After all, the following code has ten System.out.print lines. Shouldn’t your computer remember what out.print means?importjava.util.Scanner;<strong>import static java.lang.System.in;</strong><strong>import static java.lang.

      Java

       Articles

      Tackling Error Messages in Java Programming
      Sometimes, error messages can strike fear into the heart of even the bravest programmer. Fortunately some helpful, calming advice is here — advice to help you solve the problem when you see one of these messages. NoClassDefFoundError You get this error when you're trying to run your code. So first ask yourself, did you attempt to compile the code?

      Java

       Articles

      Tips for Beginning Java Programmers: Variables and Recycling
      There are a few things beginning Java programmers should know about variables and recycling. When you assign a new value to smallLetter, the old value of smallLetter gets obliterated. smallLetter is used twice, and bigLetter is used twice. That’s why they call these things variables.First, the value of smallLetter is R.

      Java

       Articles

      Tips for Dealing with Java Code Errors
      One Java instructor has an interesting policy. He said, “Sometimes when I’m lecturing, I compose a program from scratch on the computer. I do it right in front of my students. If the program compiles and runs correctly on the first try, I expect the students to give me a big round of applause.”At first, you may think this guy has an enormous ego, but you have to put things in perspective.

      Java

       Articles

      Variations on a Theme: Initializing Variables in Java
      You can choose to go for a variation on a theme. Let’s take a look at assigning values in Java. Here, it takes two lines to give the amount variable its first value:double amount;amount = 5.95;You can do the same thing with just one line:double amount = 5.95;When you do this, you don’t say that you’re “assigning” a value to the amount variable.

      Java

       Articles

      Versatile Looping Statements in Java
      If you were stuck on a desert Java island with only one kind of loop, what kind would you want to have? The answer is, you can get along with any kind of loop. The choice between a while loop and a for loop is about the code’s style and efficiency. It’s not about necessity.Anything that you can do with a for loop, you can do with a while loop as well.

      Java

       Articles

      What You Should Know about the Size of Your Java Code
      When you are coding in Java, you will want to take the actual size of your code into consideration. Let’s look at an example. But first. here are today’s new vocabulary words: foregift (fore-gift) n.A premium that a lessee pays to the lessor upon the taking of a lease. hereinbefore (here-in-be-fore) adv.In a previous part of this document.

      Java

       Articles

      Writing, Rewriting, and Rerewriting the Same Java Program
      Have you ever asked yourself what would happen if you ran the same file writing program more than once in Java. Create the tiny program below and run the program twice. Then examine the program’s output file. The output file contains only two letters. Testing the import java.io.File;import java.io.FileNotFoundException;import java.

      Related Books

      Quick Links

      About For Dummies Terms of Use Copyright © 2000-2025 by John Wiley & Sons, Inc., or related companies. All rights reserved, including rights for text and data mining and training of artificial technologies or similar technologies.
      © 2025 MARVEL

      Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

      Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant