Today you're going to learn Java app development for kids and teens! Java is a very powerful platform which is used for running the majority of devices and apps in the world all around us. The Android platform, which is an operating system for mobile devices, is built on Java.

Learning a programming language from a young age enables kids to think logically to solve problems. In particular, the Java language helps kids learn object oriented concepts at an early age. As many apps and games are developed using Java, it also motivates kids to learn a powerful programming language. This blog will cover the basics of Java, how to download and install Java SDK, and provide a simple tutorial for getting started.

What is Java?

Java was developed by James Gosling in 1995. It started as a Project with a small team of programmers at Sun Microsystems. The first Version of Java was released in 1995, since then a lot of new features & enhancements were added to Java in its every Version Release.Java has rich features ( simple, portable, platform independent, secured, ... ) which makes it stand unique among other programming languages. Many companies like Amazon, Netflix, Google, Instagram, LinkedIn, Twitter use Java in their development.

How to get started with Java

  1. Before downloading these tools, try Java out on Repl.it. Repl.it is an online based coding environment where you can get started coding within minutes! Here is our guide for how to get started with Java on Repl.it.
  2. Java JDK's latest version can be downloaded here. When installing, select all the default options.
  3. Android Studio is a program that enables users to create applications for Android devices. Make sure your computer fulfills the minimum requirements since the software is quite resource intensive. Download it here.

What is Java syntax

Java programs follow a set of rules and instructions which are referred to as Java Syntax. Here is a brief description of Java syntax:

1. Every Java statement ends with a semicolon.

2. Java is case sensitive. Uppercase vs. lowercase makes a difference!

3. Java variables store data and the data stored is called data type.

5. The Main method is where the program starts. The Main method can be identified by the “public static void main” method declaration.

Java tutorial for beginners step by step

This tutorial will guide you through the steps to build an app that takes the first name and last name, joins the 2 strings, and displays the full name. Java Variables, Data Types and String Concatenation Operator are explained in this tutorial. String is a Non-primitive / Object data type used a lot in Java programming.

1. Open the Android Studio

When going through the installation process, select all the default settings. Once setup is complete, select “New Project.”

2. Select “Empty Activity”

It should be in the middle of the grid

3. Project Settings

Give your project a name and save location. Also IMPORTANT STEP: make sure to set the language to “Java”! You can keep the minimum API version to Android 5.0 (Lollipop)

4. Wait for Android Studio to Load

Wait a couple minutes for Gradle to process. In the meantime, hide the “What’s new in Bumblebee” panel by clicking the small minimize button on the top right corner.

5. Open activity_main.xml in designer

In the “res” folder, open the “layout” folder then open “activity_main.xml.”

The rest of your screen should look like this:

6. Design screen

Under “Palette” choose “Text” and drag in two “Plain Text” boxes onto the screen. Then move the “Hello World!” TextView up. Once your UI components look like this, click on the magic wand icon to hold those UI elements in place.

5. Rename Plain Text boxes

On the right sidebar change the ID to the top Plain Text box to “textbox1” and the bottom Plain Text box to “textbox2”. Also change the TextView ID to “textview.” When you change these IDs a popup may come up, click “refactor” to apply the changes.

6. Add Import statements

Importing libraries lets us use code that has already been written by someone else to handle button presses and text input. Let’s import the code relating to Views, EditText, Button, and TextView. In MainActivity under the first “com.example…” folder, add these import statements.

7. Add onClick listener

An onClick listener determines what should happen when the button is clicked. Let’s set up the listener for the button we added. A lot of this code will be autocompleted.

8. Program the rest!

Let’s now record the text in the text boxes, add the strings, and display the text!

9. Run your code!

Run your app on the emulator by clicking the small play button. It takes a couple minutes for the emulator to start up.

Java app development course for beginners

Has Java piqued your interest? Join our live online Java classes led by an expert instructor! Our Java classes are very well designed from basic to advanced levels, which enables students to learn Java language concepts all the way through developing apps. The concepts learned in each session will be used to create real-time projects.

Get started with Java App development

In this blog, you learned about the Java String data type, and how to concatenate two strings. Join us in Java Primer with Android to begin learning all about the basics of Java syntax, Input/ Output, Variables concept, Loops, Random Numbers, Arrays, Classes and Objects, Interfaces, and much more. Up next, learn more about how to build your own app with advanced Thunkable features.

Screen-Shot-2021-10-11-at-1.33.09-PM