Wishlisted Wishlist

Please confirm that you want to add Java Programming Basics to your Wishlist.

Add to Wishlist

Java Programming Basics

Learn to program! Let's walk through some simple examples and I'll explain everything along the way.
4.5 (1,563 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
25,768 students enrolled
Created by Charles Mulic
Last updated 10/2015
English
Free
Includes:
  • 3 hours on-demand video
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Description

Learn about programming through a series of short, concise examples with line by line explanations covering everything from getting up and running to object oriented programming, data structures, and various tips and tricks to help you along your way.

Section 1 will get you up and running with everything you'll need to write and run Java programs.

Section 2 will introduce fundamental programming concepts such as variables, methods, and control structures that will put you well on your way to writing your own applications.

Section 3 dives a bit deeper as we learn about object oriented programming. You'll learn how to write code that can be reused easily, as well as gain some insight into technical details about how programs actually run on hardware.

Who is the target audience?
  • No prior knowledge is assumed. This course is aimed towards people beginning programming, or those looking for clarity on certain subjects
Students Who Viewed This Course Also Viewed
What Will I Learn?
Create Java programs from scratch
Break a large problem into smaller pieces that you can implement
Debug a program and understand how code gets executed
View Curriculum
Requirements
  • You don't need anything! Well, maybe a computer. At the start of the course, we'll walk through getting set up with the JDK and Eclipse, but you're welcome to use the IDE of your choice (or none).
Curriculum For This Course
Expand All 17 Lectures Collapse All 17 Lectures 02:48:26
+
Getting Up and Running
2 Lectures 08:54

This tutorial guides you through everything you need to begin developing Java programs.

It is assumed that you can follow the JDK install wizard.

You can download the JDK here: http://www.oracle.com/technetwork/jav...

You can download Eclipse here: http://www.eclipse.org/downloads/

Installing the JDK and Eclipse
03:23

In this tutorial we create the standard "Hello, world!" application using Java.

I introduce two very helpful shortcuts that the Eclipse IDE provides:

Automatically generate a main method: type 'main' and then press ctrl + space bar
Automatically generate a System.out.println(): type 'syso' and then press ctrl + space bar

Comments are also introduced to remind us what the main method and System.out.println do, and the shortcuts we used to generate them.

Hello World and Eclipse shortcuts
05:31
+
The Basics.
5 Lectures 59:57

In this tutorial, we cover the basics of using variables in Java.

Two of Java's primitive types are introduced: int and double

We also introduce the String type.

We go through various examples of how variables are created, used, and evaluated.

Types and Variables
13:12

I use the word function interchangeably with method in this video (out of habit--methods in Java are called functions in other languages).

This tutorial covers the basics of writing and calling methods. We show examples of methods that return a value, take arguments, and methods that simply do some task that requires neither a return value or arguments passed.

Why use additional methods when you can just put everything inside of main? Methods allow for abstraction, easy code reuse, and allow you to utilize scope.

I'm not completely satisfied with this tutorial, and may redo it in the future. Let me know if any parts are particularly confusing for you so that I can be clearer if do it again.

Methods
13:19

In this tutorial, I explain the basics of scope.

A variable declared outside of any method with the static keyword is called a class variable, and is available to all methods in the class (variables without the static keyword are called instance variables, and will be covered with object-oriented programming in future tutorials).

A variable that is declared inside of a method is local to that method, and only exists until that method is finished executing. It is not directly available to any other methods in the class.

Variable Scope
06:31

This tutorial covers just about everything you'll need to know about if statements in Java.

There is another less common type of statement that allows similar functionality called the switch statement, and I will cover it briefly in a future tutorial when we have a practical use for it.

Sorry for the heavy edits. I wanted to get the time under YouTube's 15 minute limit so that I wouldn't have to break it into two parts.

Conditionals
14:54

In this tutorial we look at the three main types of loops in Java: the while loop, the do-while loop, and the for loop.

The debugger is also introduced. It allows us to see exactly how Java executes loops.

There is another form of the for loop that is shorthand for iterating over every element of a collection that will be covered in the future.

You can also achieve similar looping functionality using something called recursion, which will also be covered in the future.

Loops (and an intro to the debugger!)
12:01
+
Object Oriented Programming
10 Lectures 01:39:35

In this tutorial, I demonstrate how to instantiate and use objects by example. We use a JFrame object to create a window, and add a JLabel object to it.

You should probably add: window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // ensures program ends when we close window)

I also mention that Strings are actually objects (as a convenience, Java allows us to instantiate strings by using a string literal, that is, text in quotes).

You can use objects through what is called their interface, in other words, the methods that they make visible to us as users of the object. You can see all of the methods available via Eclipse's code assist feature by typing the object variable name followed by a "." (you can also bring up code assist by pressing ctrl + space).

Using Objects: Creating a Window
10:34

In this tutorial we learn how to instantiate objects from classes that we create. We learn about instance variables, instance methods, and constructors. Getters and setters are introduced and encouraged as good coding practice.

The static modifier is also explained.

You would usually make instance variables private when public getters/setters are provided as part of the interface, but access modifiers have not yet been covered in this series.

You can also move the main method to the Person class and keep the program for this tutorial in one file, however, I thought it would better get the concept across by having the Person class be isolated from main.

Classes and Objects
14:17

In this tutorial we look at the difference between value types (primitives) and reference types (objects).

Primitives are passed by value, so when passed to a method, you aren't manipulating the original data, but a copy of that data.

Objects, on the other hand, are passed by reference, so you have the ability to change objects through that reference inside of methods.

Reference and Value types
07:46

In this tutorial, Java's access modifiers are explained. For now, public and private should make sense. Protected and default access are introduced, but won't be fully understood until packages and inheritance are covered.

As a best practice, I recommend using the private modifier as much as possible. This prevents users of your classes, which includes you, from manipulating the data for the class directly or calling methods that were only meant to be helper methods internal to the class. It will also decrease the number of things you can do with an object of that type as a user, so it makes it easier to learn or remember how to use it.

You should especially avoid making your variables directly accessible. The benefit of using methods to set values to your variables is that you can do error checking inside of those methods prior to the assigning the value. For example, it wouldn't make sense to try to set a Person's age to a negative value, so you can test to see if a negative value was passed to setAge() and handle it accordingly.

Access Modifiers
05:04

In this tutorial, we learn how to create and nest packages. We'll move all of our existing classes into a new package, and use this and other packages in the future to keep our classes organized.

I change to a hierarchical view for packages, but feel free to keep a flat view if you prefer.

I also show how using packages avoids naming conflicts by showing an example of using a fully qualified class name instead of an import.

The default and protected access modifiers are discussed briefly since they deal with package wide access.

Packages
06:30

In this tutorial I introduce data structures and we learn how to use one of the most basic structures, the array.

We look at different ways we can initialize an array, how to set values to array elements, how to get values from array elements, and how to iterate over an array using loops.

Be sure to remember that an array index starts at 0, so if you create an array of size 10, the indices will be 0-9. The last elements is always at the index size - 1.

This introduction is in no way comprehensive--there is much more to learn about arrays, but it should get you familiar with seeing and experimenting with arrays.

Data Structures intro: Arrays
12:05

In this tutorial I explain how to make constants in Java by using the final modifier on variables.

By convention, constants are capitalized with words separated by underscores.

You usually want to make constants static because they typically do not change values across different instances. Using the static modifier also allows you to use the variable without creating any instances.

It is also generally safe to make your constants have public visibility, since applying the final modifier makes the variable read-only.

Constants
06:12

In this tutorial, I introduce a powerful feature of object-oriented programming: inheritance.

Inheritance allows you to have one class "inherit" the variables and methods of another. This help promotes code reuse, because common code is refactored to parent classes. It also helps keep your classes light weight and manageable.

All objects in Java extend the class Object. One thing I didn't touch on in this video is the notion of inheritance hierarchies. For example, even though our Child extends Parent, our parent still extends Object, so the full hierarchy is:

Object - Parent - Child

Thus Child "is-a" Parent, and also "is-a" Object.

Intro to Inheritance
09:54

In this tutorial, we continue learning about inheritance by covering overriding methods. Technically, overriding methods isn't specific to inheritance, but we will learn more about that after a couple more videos.

You can override inherited methods by creating a method with the same signature as one that is inherited (same name, return type, and parameters). Or you can use Eclipse's code assisting to do that for you, as I do in this video.

You can use the super keyword to reference the instance of the base class, and use it to call methods or access variables. This is useful for when you need to override a method to add additional functionality, rather than replace it entirely.

The @Override is called an annotation, is optional, and isn't important to learn about right now.

Overriding Methods: drawing on a frame
12:36

In this tutorial, we build on our understanding of inheritance by introducing abstract classes and abstract methods.

An abstract class is a class that exists purely to be extended. You can not create an instance of an abstract class.

An abstract class may have abstract methods. Abstract methods provide no implementation. They only provide the method signature (return type, name, and parameters). Any class that then extends the abstract class must provide an implementation for any abtract methods it inherits (unless that class is also abstract).

Another important note from this video is that the type of a variable determines the interface for the object it refers to (what you can do with it). For example, if we refer to Player by type GameObject, we are not able to call any methods specific to Player on that instance (unless we cast it to Player). This is something that we're likely to see more of in future tutorials.

Abstract classes and methods
14:37
About the Instructor
4.5 Average rating
1,554 Reviews
25,768 Students
1 Course
Professional Code Monkey

Professional software engineer, hobbyist game developer, past Computer Science tutor, and occasional tutorial producer! That sounds more impressive than it is.

I've been coding in some form or another for as long as I've had a computer to do it on.

When I'm not doing that, I enjoy catching up on some shows, playing games online with some friends, and even occasionally going outside.

Report Abuse