Library

Course: From 0 to 1: Learn Java Programming -Live Free,Learn To Code

From 0 to 1: Learn Java Programming -Live Free,Learn To Code

  • Life Time Access
  • Certificate on Completion
  • Access on Android and iOS App
About this Course
  • Taught by a Stanford-educated, ex-Googler, husband-wife team
  • This course will use Java and an Integrated Development Environment (IDE). Never fear, we have a detailed video on how to get this downloaded and set up.
  • Hundreds of lines of source code, and hundreds of lines of comments - just download and open in your IDE!

A Java course for everyone - accessible yet serious, to take you from absolute beginner to an early intermediate level

Let’s parse that.

  • This is a Java course for everyone. Whether you are a complete beginner (a liberal arts major, an accountant, doctor, lawyer) or an engineer with some programming experience but looking to learn Java - this course is right for you.
  • The course is accessible because it assumes absolutely no programming knowledge, and quickly builds up using first principles alone
  • Even so, this is a serious Java programming class - the gradient is quite steep, and you will go from absolute beginner to an early intermediate level
  • The course is also quirky. The examples are irreverent. Lots of little touches: repetition, zooming out so we remember the big picture, active learning with plenty of quizzes. There’s also a peppy soundtrack, and art - all shown by studies to improve cognition and recall.

What's Covered:

  • Programming Basics: What programming is, and a carefully thought-through tour of the basics of any programming. Installing and setting up an IDE and writing your first program
  • The Object-Oriented Paradigm: Classes, Objects, Interfaces, Inheritance; how an OO mindset differs from a functional or imperative programming mindset; the mechanics of OO - access modifiers, dynamic dispatch, abstract base classes v interfaces. The underlying principles of OO: encapsulation, abstraction, polymorphism
  • Threading and Concurrency: A deep and thorough study of both old and new ways of doing threading in Java: Runnables, Callables, Threads, processes, Futures, Executors.
  • Reflection, Annotations: The how, what and why - also the good and bad
  • Lambda Functions: Functional constructs that have made the crossover into the mainstream of Java - lambda functions, aggregate operators.
  • Modern Java constructs: Interface default methods; properties and bindings too. Also detailed coverage of Futures and Callables, as well as of Lambda functions, aggregation operators. JavaFX as contrasted with Swing.
  • Packages and Jars: The plumbing is important to understand too.
  • Language Features: Serialisation; why the Cloneable interface sucks; exception handling; the immutability of Strings; the Object base class; primitive and object reference types; pass-by-value and pass-by-object-reference.
  • Design: The MVC Paradigm, Observer and Command Design Patterns.
  • Swing: Framework basics; JFrames, JPanels and JComponents; Menus and menu handling; Trees and their nuances; File choosers, buttons, browser controls. A very brief introduction to JavaFX.

Programming Drills (code-alongs, with source code included)

  • Serious stuff:
  • A daily stock quote summariser: scrapes the internet, does some calculations, and outputs a nice, formatted Excel spreadsheet.
  • A News Curation app to summarise newspaper articles into a concise email snippet using serious Swing programming
  • Simple stuff:
  • Support with choosing a programming environment; downloading and setting up IntelliJ.
  • Simple hello-world style programs in functional, imperative and object-oriented paradigms.
  • Maps, lists, arrays. Creating, instantiating and using objects, interfaces

Who is the target audience?

  • Yep! Folks with zero programming experience - liberal arts majors, doctors, accountants, lawyers
  • Yep! Engineering students from non-CS majors looking to learn fairly serious programming
  • Nope! Experienced Java programmers - this class will be boring for you:)
  • Yep! Computer Science students or software engineers with no experience in Java, but experience in Python, C++ or even C#. You might need to skip over some bits, but in general the class will still have new learning to offer you :-)
Basic knowledge
  • No prior programming experience needed:)
  • The class will make use of Java and an IDE - never fear, we have a detailed video to walk you through the process of setting this up
What you will learn
  • Write Java programs of moderate complexity and sophistication (at an early to middling intermediate level)
  • Understand Object-Oriented programming concepts at the level where you can have intelligent design conversations with an experienced software engineer
  • Manage concurrency and threading issues in a multi-threaded environment
  • Create and modify files (including Excel spreadsheets) and download content from the internet using Java
  • Use Reflection, Annotations, Lambda functions and other modern Java language features
  • Build serious UI applications in Swing
  • Understand the Model-View-Controller paradigm, the Observer and Command Design patterns that are at the heart of modern UI programming
  • Gain a superficial understanding of JavaFX and Properties and Bindings
  • Understand the nuances of Java specific constructs in serialisation, exception-handling, cloning, the immutability of strings, primitive and object reference types
Curriculum
Number of Lecture: 84
Total Duration: 16:49:53
You, Us & This Course
  • Introduction  

    Note: This class has hundreds of lines of source code, and hundreds of lines of comments - just download and open in your IDE!

    We - the course instructors - start with introductions. We are a husband-wife team, studied at Stanford, and spent several years working in top tech companies, including Google, Flipkart and Microsoft.

    Next, we talk about the target audience for this course: folks who are completely new to programming - liberal arts majors, accountants, lawyers, doctors - as well as engineers who have done some programming (maybe in Python, C# or C++) and are now looking to learn Java from 0 to 1.

    By the end of this class, you will be able a fairly serious Java programmer, at an early intermediate level. You will understand object-oriented concepts, concurrency and threading, language features such as reflection, annotations and so on. You will also build a substantial UI app using Swing, and learn about the MVC paradigm.

Coding Is Like Cooking
  • Coding is like Cooking  

    If you are absolutely new to coding, don't be intimidated in the least - its just like cooking.

  • Functions as Food Processors  

    If coding is like cooking, functions are like food processors. They automate repetitive tasks by mechanically taking stuff in and churning stuff out.

  • Installing Java and Setting up an IDE  

    Let's make sure you are all set up to run Java and write Java programs. We will walk through installing Java, and getting set up with IntelliJ, an excellent IDE

  • Variables - Primitives, Objects, Null  

    There are two important types of variables in Java: primitive types and object reference types. Oh, and there is also a special value called null.

  • Hello World! (Drill)  

    Let's write our first little Java program. We will create a few variables and print some stuff to screen.

  • Don't Jump Through Hoops, Use Loops  

    Ever wondered what's the biggest difference between Excel, and a serious programming language like Java? Loops. Loops are big productivity boosters. Lists and arrays are both ordered collections of elements. Arrays and lists not exactly the same though - in general lists are more handy to use.

  • Arrays and Lists - Drill  

    Let's do some stuff using arrays, lists and loops. This is the basic idea of most imperative programming - create lists, and do stuff to those lists using loops.

  • Maps  

    Maps are also called Dictionaries, and that other name best describes what they are: collections of key-value pairs that you can look up blazingly fast.

  • Maps - Drill  

    Let's make sure we know how to use maps and do stuff with them: the idea of storing key-value pairs in a collection, and looking up the values for a particular key is key (bad pun alert!)

An Object-Oriented State of Mind
  • The Evolutionary Arc from C, through C++, to Java  

    We introduce Java and summarize how it is an evolutionary descendent of C and C++. Memory management in Java, different programming paradigms and a quick how-to on the Intellij IDEA (the Java Integrated Development Environment we will be using)

  • Objects are like puppies  

    Before we start with the serious stuff, remember this - Objects, like puppies, are your best friends.

  • Classes and Objects: An Object-Oriented State of Mind  

    Object-oriented programming languages require you to think in terms of objects and classes. We formally introduce these concepts, as well as encapsulation, abstraction, inheritance and other basic tenets of OO programming. Next come instantiation, member variables and member functions (static and non-static), start with access modifiers (public, private, protected) and finish with constructors and finalizers.

  • Static Variables and Methods  

    Static member variables and static member functions are class-specific, not object-specific.

  • Access Modifiers  

    Member variables and functions can be marked public, private or protected - these keywords are called access modifiers, and they govern the access that derived class objects have to their corresponding base class objects.

  • Classes and Objects: A Simple Example I  

    A simple coding drill that demonstrates all that we've covered so far: defining classes,instantiation(creating objects), different member variables and different member functions, getters, setters, constructors and finalizers.

  • Classes and Objects: A Simple Example II  

    We continue our simple coding drill that demonstrates all that we've covered so far: defining classes,instantiation(creating objects), different member variables and different member functions, getters, setters, constructors and finalizers. In this bit, we focus on instantiating objects, and on static member data.

  • Is-A Inheritance - setting up a class hierarchy  

    What does it really mean for a class to derive from another class? We examine the idea of inheritance using Shapes.

  • Is-A Inheritance - parent class, child class relationship  

    We continue with our exploration of inheritance and explore how derived class objects have a full version of the base class object within them. This is illustrated using a class hierarchy involving planes and fighter planes.

  • Runtime Polymorphism  

    Runtime polymorphism is an important OO concept. If an object of type Rectangle holds a reference to derived class Square, will our shape behave like a Rectangle or a Square?

  • The Object Base Class  

    We explore the Object base class, which all Java reference types derive from.

  • Interfaces : Introduction  

    We introduce Interfaces: a special type of classes that have only function signatures but no function implementations.

  • Interfaces vs Abstract Base Class  

    Abstract base classes and abstract functions are covered in this class. We also compare when it makes sense to use interfaces, and when abstract base classes are a better choice.

  • Interfaces In Detail  

    Upcasting, downcasting and the instanceof operator. Upcasting is OK but be careful with downcasting

  • Interface Default Methods: Avoid Backward Compatibility Nightmares  

    Interface default methods are a new feature in Java, that allow us to go back and retro-fit new methods into old interfaces. Interface default methods involve adding implementations to interfaces, which might seem like cheating, but its all in a great cause: this prevents an explosion of the class hierarchy and maintains backward compatibility in code.

  • Interfaces and Inheritance in Action  

    We've talked a lot about interfaces, now let's walk the talk with a nice little drill.

Java Language Constructs: The Best Thing Since Sliced Bread
  • Exceptions  

    Stuff happens - that's life. And when stuff happens, exceptions get thrown. Let's understand how modern programming languages (including Java) deal with unexpected situations. The basic idea: a chain of responsibility, where somebody needs to stand up and be counted. Coding is a lot like life.

  • Object Identity: == and .equals()  

    When are two objects 'equal'? How are the == operator and .equals() different from each other?

  • Generics: Type Safety and Code Re-use  

    Generics are a language feature that help Java maintain its tight rules on Type Safety, while also facilitating code re-use.

  • Collections: Containers for all purposes  

    Decades ago, when Java first appeared, its incredibly handy collections were among its biggest attractions over C++; much has changed, but Java collections are still incredible. Lists, maps, sets, and standard ways to iterate over them.

  • Generic Containers - much cooler  

    We tie together the ideas of collections and generics - a cool feature that came to Java relatively late (after C++ and C#) but is so handy!

  • Ordered Associative Containers - The Tree Map  

    Map elements can be ordered too! Java provides a special class called the TreeMap which is a Map in every sense of the word, and offers a way to order the keys stored in the Map, not something other Maps provide.

  • Inner Classes: Horses for Courses - Static vs Non-Static  

    Java has a clever way to sort collections: using Comparator objects. (Aside: This clever technique combines the Strategy and the Command Design Pattern). We see how Comparators and Collections work together: nested classes (the classes inside classes) and types of nested classes (static and non-static classes which are also called anonymous inner or local classes).

  • Inner Classes: Horses for Courses - Anonymous and Local  

    We wrap up our exploration of inner classes with a look at Anonymous and local classes. Anonymous classes are used heavily in UI, while local classes are very infrequently used.

  • A File is like a Barrel  

    Working with files can sometimes seem boring - filled with repetitive boilerplate code. But files can get a bit more interesting if we get why they are so handy and so ubiquitous.

  • A Serious Java Application: Our First  

    We will be making a useful Java application in this drill using concept of files and classes. The Java application will download daily stock data from a stock exchange website and output an excel file of top movers and heavily traded stocks. The ability to create Excel spreadsheets is a big win: we will use the Apache POI library, which will also serve to show we can use code written by someone else packaged into something called a JAR file.

  • A Serious Java Application: Parsing Stock Ticker Data - I  

    We will be making a useful Java application in this drill using concept of files and classes. The Java application will download daily stock data from a stock exchange website and output an excel file of top movers and heavily traded stocks. The ability to create Excel spreadsheets is a big win: we will use the Apache POI library, which will also serve to show we can use code written by someone else packaged into something called a JAR file.

  • A Serious Java Application: Parsing Stock Ticker Data - II  

    We will be making a useful Java application in this drill using concept of files, classes, nested classes and comparator. The Java application will download daily stock data from a stock exchange website and output an excel file of top movers and heavily traded stocks.

  • A Serious Java Application: Parsing Stock Ticker Data - III  

    We will be making a useful Java application in this drill using a java library (JAR) called POI created by open-source powerhouse called Apache. The JAR POI has a set of classes to work with excel. The Java application will download daily stock data from a stock exchange website and output an excel file of top movers and heavily traded stocks.

  • A Serious Java Application: Parsing Stock Ticker Data - IV  

    We will be making a useful Java application in this drill using a java library (JAR) called POI created by open-source powerhouse called Apache. The JAR POI has a set of classes to work with excel. The Java application will download daily stock data from a stock exchange website and output an excel file of top movers and heavily traded stocks.

  • A Serious Java Application: Parsing Stock Ticker Data - V  

    We will be making a useful Java application in this drill using a java library (JAR) called POI created by open-source powerhouse called Apache. The JAR POI has a set of classes to work with excel. The Java application will download daily stock data from a stock exchange website and output an excel file of top movers and heavily traded stocks.

Threading and Concurrency: A Lot Going On All At Once
  • Threading, and Why It Matters  

    As computers have become multi-core, and then as cloud computing has taken off, the importance of threading has increased substantially. This lecture is an introduction to the concept of threading which allows programmers to do different things simultaneously. We will also discuss the differences between processes and threads, old school concepts vs new school concepts in threads and some use-cases of threads.

  • Threading: Old school vs New school  

    We'll talk about a specific use case for threading where spinning off multiple threads can give us huge performance gains. Java support for threading is great even in its traditional form. New libraries however, make working with threads far easier.

  • Traditional Threading Support  

    We study threading the way it has traditionally been done in Java - the Runnable interface; extending the Thread class; join(), sleep() and thread interrupts.

  • Threading and Concurrency: A lot going on at once  

    Multi-threading involves concurrent execution of threads, and this gives rise to an entire range of potential issues: thread interference, memory consistency and thread contention.

  • Synchronized Methods, Livelock, Deadlock and Starvation  

    Methods can be marked as synchronized - we study the nuances of doing so. We also examine threading issues such as livelock, deadlock and starvation.

  • Working with threads - and our first synchronization bug!  

    Let's figure out how to set up a multi-threaded program - and while doing so, we also encounter our first synchronization bug. We congratulate ourselves - wrestling with synchronization bugs is the badge of a serious programmer!

  • Threads: Object locking and static variables in action  

    We continue with our drill, and use our first lock. We learn yet another important thread-related lesson - that static variables can not be locked using the synchronized keyword.

  • Digging Deeper into Callables and Futures  

    In this lecture, we will talk about new features of Java which significantly improves its support for concurrency - the Callable interface,executors,thread pools, lock objects, concurrent collections and atomic variables. We will show how these new features make multi-threading a lot more robust.

  • Threading: New school fun in action  

    We go back and reprise our threading drill, but this time we do so using the new threading framework - Callables instead of Runnables, and Executors instead of the Thread objects, and Future objects to retrieve the results.

  • Threading: Executors are pretty cool  

    We now delve into the power of the new threading features - a CompletionService, for instance, which allows us to retrieve results from threads in the order in which they complete.

Functional Programming: Crossover Hits
  • Functional Programming: A State of Mind  

    Functional, Imperative or Object-Oriented? Our choice of programming paradigm profoundly shapes how we design and write our code. We quickly explore how these three programming paradigms differ. This is a nice lead-in to lambda functions, which are a crossover hit from functional programming into object-oriented Java.

  • Lambda Functions: A Crossover Hit  

    Introducing lambda functions, which are a functional programming concept that became so popular that Java added support for them. Very handy at reducing code bloat, particularly in UI programming.

  • Lambda Functions: No more boiler-plate code  

    More on Lambdas, and a look at aggregation operations - stream, map, filter, foreach - all of which are newly added to Java.

  • Lambda functions for real - in code  

    A coding drill that illustrates the appeal of lambda functions and aggregate operators. We will sort a list of names in the drill using two approaches - imperative and functional. We will use .stream() and aggregate functions.

Recursion, Reflection, Annotations, Dates, Packages and Jars
  • Recursion  

    Recursive functions are functions that call themselves. This can be a little abstract to wrap your head around, but once you do, the idea is - beautiful.

  • Reflection: Not a Dark Art  

    Reflection and Type Introspection are ways to do things 'on-the-fly' with classes and objects: create objects directly from their classes, check out what methods these classes have, invoke those methods and so on. This lecture covers the pros, cons and complexities of reflection. We will also cover old school approach to unit testing and how reflection solves the problems of old school approach.

  • Reflection: A real use case  

    Reflection can be really useful in specific use-cases, unit testing is an excellent example

  • Annotations: Notes to Self can be Super-Useful  

    This lecture is about annotations. Annotations in Java are notes added to the code. The lectures explains how annotations are different from comments, how are they processed by compiler and how programmers can take advantage of annotations. We will also cover some built-in annotations.

  • Working With Dates in Java  

    Working with Date, Instant, Duration, Calendar and other common classes. Epoch time and what it means and how you use it in code to calculate time.

  • Jars: Not As Boring as They Might Seem  

    We will talk about packages and jars in this lecture. We will talk about what they mean, how they are useful and how jar files are smarter than zip files (Hint: self-awareness is the start of smartness. Another hint: Metadata)

  • Packages  

    We'll see how packages help create namespaces in Java. Packages are closely linked to the directory structure of Java source code.

  • Packages and Jars in Action  

    A little drill where we see packages and jars in action

  • Serialisation  

    Objects can save themselves to file really easily in Java. - this used to be really hard, but now its pretty easy. We see how, and study the Serializable interface.

  • Cloning  

    Objects have a way to clone themselves, but it is (surprisingly) rather broken in Java. We look at the Cloneable interface, and the .clone method. Not Java's finest hour.

  • The Immutability of Strings  

    Strings never change. Unlike almost everything else in life, they are immutable. Let's see how.

UI Programming: Swing, MVC, and JavaFX
  • Frameworks - A State of Mind  

    Frameworks are complicated sets of interconnected classes: they are incredibly powerful, but take some getting used to. This class introduces the concept of frameworks and explains how they work with a simple analogy. Using a framework has some trade offs, we give up complete control over our application in return for incredible speed of development and lots of built-in support.

    Frameworks are heavily influenced by the Observer design pattern, communication is via events and the corresponding listeners.

  • The Basic Idea of Swing  

    This lecture is an intro to Swing - a Java framework used for building graphical user interfaces (GUI). We will cover basic components of Swing framework - JFrame and JComponent. We will also talk about its strengths and weaknesses.

  • Swing and the Model-View-Controller Paradigm  

    The Model-View-Controller (MVC) paradigm is ubiquitious in UI programming; along with the Observer and Command patterns, MVC has practically defined modern User-Interface programming.

  • The Mechanics of Swing - I  

    We plunge into Swing which is a prototypical UI programming framework. We start with the building blocks of Swing (JFrame and JComponent). Next - the idea of layouts which position controls on screen, and the border layout as an example. Then, JComponents(JTextArea, JTreeView, JMenuBar, JScrollPane, JPanel and JFileChooser).

  • The Mechanics of Swing - II  

    This lesson explores the different classes that Swing provides for UI components such as menus (JMenuBar, JMenu, JMenuItem). Trees in Swing are pretty powerful but complicated to use, we learn how to deal with their intricacies.

    We also learn how to capture and handle mouse events.

  • A Serious Swing App: News Curation Browser - I  

    We build a serious Swing application - the News Curation App: The objective of the drill is to build an application that helps in curating news snippets and quickly summarizing articles. We will use helper classes to write to an HTML file, set up the Model portion of the MVC paradigm. This stores the underlying data for the application.

  • A Serious Swing App: News Curation Browser - II  

    We continue with our News Curation Swing App. This class focuses on the View portion of the MVC paradigm. We will set up the UI of our drill in this video using JTree, JEditorPane and JTextArea. We learn the use of scrollpanes to set up scroll bars in our UI when content overflows its container.

  • A Serious Swing App: News Curation Browser - III  

    As part of our News Curation Swing app - we setup a tree structure for navigation. In Swing this can be done using the JTree class which renders the view. The JTree requires a corresponding model and a bunch of listeners to set it up completely. This drill looks at wiring up the tree completely - no mean task!

  • A Serious Swing App: News Curation Browser - IV  

    We continue with our News Curation Swing App. This class focuses on the Controller portion of the MVC paradigm. We wire up a whole bunch of events listeners, for the File->Save menu, tree navigation and selection listeners, text area change listeners and the Go! button click listener.

  • Observers, Events and Listeners  

    The Observer Pattern, along with the MVC and Command Patterns, has practically defined modern UI programming. Publishers publish updates when their state changes, and Subscribers can listen in on these updates. An event is fired when the state changes, and the listener responds via a Command object called the event listener code.

  • Actions, And The Command Design Pattern  

    The Command Design Pattern is used to separate an action from its execution. A seemingly abstract idea, and an incredibly powerful one. The Command Pattern, along with the Observer and MVC Patterns, has practically defined modern User Interface Programming.

  • A Peek at JavaFX - I  

    We introduce JavaFX, a new framework which is intended to replace Swing as the standard GUI library for Java. JavaFX features are much more powerful than Swing - stuff such as Properties and Bindings, CSS support pack a real whammy.

  • A Peek at JavaFX - II  

    This course continues with JavaFX features which make it so powerful. Scenebuilder and FXML allow decoupling model and controller code from UI design and definition. Built in 3D effects (illumination, material textures and camera effects), support for animations, charting, audio and video media all make JavaFX a great choice for building user interfaces.

  • Properties And Bindings  

    Properties and Bindings are a Java beans programming construct which allow wiring up of variables to express relationships between them. JavaFX uses this extensively within its framework to expose granular updates for various events.

  • Properties And Bindings In Action  

    This class looks at code for defining, listening on and binding to a property. We'll introduce the ObservableValue<T> interface and see how it differs from the old Observer interface.

Some Interview Problems For Practice!
  • Starting up - palindromes and points within a distance  

    During coding interviews you might encounter questions which you can work out from first principles. You should be nailing these! Let's start with figuring out whether a string is a palindrome and finding all the points within a certain distance from another point.

  • Play the Game Of Life and Break A Document Into Chunks  

    Two more problems and detailed solutions. Play the game of life where every cell can change states from live to dead based on its neighbours.

    Then move on to breaking a document into chunks to send down to a client subject to very specific constraints.

  • Implement paint fill to color a region on screen  

    Paint fill allows you to color regions on screen while using drawing software. Implement a recursive solution to paint fill a region on the display screen.

Reviews (0)