
Explore how programming creates software that runs on personal computers and devices, and why there is no single best language for solving problems.
Explore computer basics, programs, and the World Wide Web with Java. Learn the Java language specification, API, JDK, and IDE; write, compile, and run a program in IntelliJ IDEA.
Explore the fundamental hardware and software of a computer, including the CPU, memory, storage, input/output, and communication devices, and how they work together to run programs.
Explore how binary, as 0s and 1s, powers computers through transistors, bits and bytes, and how ASCII maps characters like uppercase letters to binary values, with 8-bit and 16-bit representations.
After learning this course you will learn :
Machine Language
Assembly Language
High-level Language
What is an interpreter
What is a compiler
What is the difference between an interpreted language and a compiled language?
After learning this course you will be able to :
Understand the concept of Operation System
What are the major responsibilities of an operating system
What are multiprogramming, multithreading, and multiprocessing
After learning this course you will be able to answer these questions below:
What is the Java language specification?
What does JDK stand for?
What does IDE stand for?
Are tools like NetBeans and Eclipse different languages from Java, or are they dialects or extensions of Java?
Learn to write a simple Java program that prints 'Welcome to Java!' to the console, using a class with a main method and proper braces and semicolons.
After learning this course you will be able to answer these answers:
What is the Java source filename extension, and what is the Java bytecode filename extension?
What are the input and output of a Java compiler?
What is the command to compile a Java program?
What is the command to run a Java program?
What is the JVM?
Can Java run on any machine? What is needed to run Java on a computer?
If a NoClassDefFoundError occurs when you run a program, what is the cause of the error?
If a NoSuchMethodError occurs when you run a program, what is the cause of the error?
Create Welcome.java in a text editor, define a Welcome class with a main method that prints 'Welcome to Java!', save as Welcome.java, then compile with javac after installing the JDK.
After learning this course you will be able to :
Download JDK and install it on your computer (For me I use Mac version please choose the version fit your OS)
Use javac and java commands provided by the JDK to compile and run your Java program
After learning this course you will be able to understand what are:
Appropriate Comments and Comment Styles
Proper Indentation and Spacing
Block Styles
How to download Intellij IDEA
How to write your first Java program by using Intellij IDEA
What content you will learn after learning this chapter
How to user Intellij IDEA write a simple program to compute the area of the circle
You will learn how to Modify the code of previous course that read the user input from the Console.
What is Named Constant or Constant
The benefit of using Constant
What is the Java naming conventions
What is the benefit of following Java naming conventions
Numeric Types
Reading Numbers from the Keyboard
Numeric Operators
+
-
*
/
%
Exponent Operations
Integer Literals
Floating-Point Literals
Scientific Notation
Why are they called floating-point numbers?
precedence rule is used to determine the order of
evaluation
What is GMT
Write a program displaying the current time
What is Augmented Assignment Operators
Increment Operators
Decrement Operators
Postfix Operators
Prefix Operators
Explore numeric type conversions in Java, including explicit casting and widening from int to double. Learn how casting truncates fractions and may cause data loss when narrowing, using (type) value.
Software Development Process
Explore the software development process by building a loan payment calculator, detailing requirements specification, analysis, design, implementation, and testing while computing monthly payment and total payment from user inputs.
Explore case study in Java programming that converts a decimal dollar amount to cents and distributes it into dollars, quarters, dimes, nickels, and pennies to minimize coins.
This chapter's Objectives
Learn how the boolean data type stores true or false values and how to use comparison operators to evaluate expressions, including equality versus assignment.
Learn Java if statements and related constructs like if-else, switch, and conditional expressions, with braces usage demonstrated, through a user-input program that prints 'Hi five' or 'Hi even'.
Learn how two-way if-else statements control execution in Java by acting when conditions are true or false, with syntax and a flowchart example like radius is less than zero.
Explore logical operators in Java, including not, and, or, and the exclusive logical operator, to build compound boolean expressions. Learn truth tables, precedence, and how parentheses clarify evaluation in code.
Explore how logical operators work in Java, using and, or, and not, with examples that compare x to zero, test equality, and evaluate true or false results.
Learn to determine leap years in Java using modulo checks and logical operators: divisible by 4 but not by 100, or divisible by 400, and test with 2008.
Generate two random single-digit integers in Java, swap if needed, then prompt the user to compute the difference and display whether the answer is correct.
Explore the switch statement in Java, replacing complex if-else chains with a clear switch syntax, including cases, default, and break, plus practical examples like tax, weekdays, and Chinese zodiac.
Use the integrated debugger to set breakpoints, step over and into code, and inspect variables to diagnose a division by zero error in a Java program.
Learn core loop concepts in Java by using while and for statements, and create nested loops. Apply break and continue, handle sentinel values, and print prime numbers.
Explore the while loop, loop body, and counter-controlled iterations, where a boolean loop continuation condition determines execution and prevents infinite loops, with a Welcome to Java example.
Explains how the do-while loop executes the body before checking the condition, contrasts it with the while loop, and demonstrates a user-input sum example.
Learn the Java for loop syntax, including initialization, loop condition, and post-iteration actions, with control variable scope and examples that avoid infinite loops.
Choose among for, while, and do-while loops by understanding pre-test and post-test evaluation and the equivalence of loop forms, and select the most intuitive option.
Master Java methods: define and invoke with formal and actual parameters; support return values or void, explore ambiguous overloading, implement hexadecimal to decimal conversion, and apply method abstraction, stepwise refinement.
Define and invoke a sum method with two parameters to compute series like 1-10, 20-30, and 35-45, reusing common code through method abstraction.
Define and call a static max method in Java, pass parameters, and handle return values or void, then invoke it from another class to reuse code.
Explore the method call stack, activation frames, and activation records as the runtime stack grows with method invocations and returns, illustrated by a main, A, B, and C example.
Explore void methods that do not return a value, and how to define and invoke them, contrasted with returning methods like getGrade that produce a value using return.
Define max methods with the same name but different parameters to compare int and double values. Learn how the compiler chooses the best match and avoids ambiguous invocations.
Explore variable scope in Java, focusing on local variable lifetimes within blocks and loops, and how inner blocks create separate scopes and name conflicts.
This chapter covers single-dimensional arrays in Java, including declare and initialize, display, sum, min and max, copy contents, for-each loops, pass arguments to main, and binary search and selection sort.
Learn how to declare, create, and initialize single-dimension arrays in Java with the new operator, access elements using 0-based indices, and iterate with for loops using length.
Learn to process arrays in Java using for loops to initialize, display, sum, find the maximum, and shuffle or reverse elements, with user input and random values.
Explore how to write a Java program that reads numbers with a scanner, stores them in an array, computes the sum and average, and counts values above the average.
Explain how arrays are passed to methods in Java: pass by value versus pass by reference, how references affect original arrays, and why swaps inside methods behave differently.
Understand how to declare a variable-length argument list in Java with a last-parameter varargs, and see how the printMax method computes the maximum from those values in an array.
Explore the linear search approach in Java, and learn how to scan an array sequentially, compare each element to a target, and return the index or -1 if not found.
Explore how the Arrays class in Java enables sorting arrays, performing binary searches, comparing arrays with equals, and using copy, fill, and toString methods to display results.
Learn how to pass command line arguments to the Java main method via the args array, print them with a for loop, and handle spaces with quotes.
Define a calculator program that reads three arguments: a first integer, an operator, and a second integer, and computes the result using a switch on the operator.
Explore declaring and accessing two-dimensional and multi-dimensional arrays with row and column indexes, perform display, sum, min, max, and shuffle operations, and build grading question programs.
Learn to declare, create, and access elements in two dimensional arrays (matrices) in Java, using row and column indices, with initialization examples and a distance table.
Explore passing a two dimensional array to a method, returning a 2D array, and calculating the sum of elements from a user entered 3x4 matrix, shown with a 78 total.
Write a Java program that grades a ten-question multiple-choice test for eight students by comparing a 2d answers array to a 1d key and displaying each student’s score.
Solve the geometric problem of finding the two nearest points by reading points, computing distances, and tracking the closest pair indices.
Define classes as blueprints for objects, detailing their state with data fields and their behavior with methods, including constructors for initialization.
Define a circle class with radius, provide default and parameterized constructors, and implement get area, get perimeter, and set radius; instantiate objects in a test class.
Model a TV as a class with channel, volume, and power state; implement a public constructor and methods to turn on/off, set channel, channel up/down, and volume up/down, test objects.
Explore how reference data fields behave, including default null values for reference types, and explain why local strings must be initialized before use in methods.
Explore how static variables share data across all objects, contrast with instance fields, and use static methods to access class data, including counting objects.
Explore visibility modifiers in Java, including public, default (package-private), and private, and learn how these modifiers control access. Private restricts access to its own class.
enforce data field encapsulation by declaring fields private, expose values through getters and setters to prevent tampering, validate radius and object count, and improve maintainability of the circle class.
Explore how Java passes objects to methods by value, via object references. See how primitive values differ, while object references can alter the original circle through a called method.
Explore how the this keyword references the object itself and enables invoking another constructor, while also linking to instance fields and parameters.
Explore association in class design, with UML representations of student, course, and faculty relationships, multiplicities, and the roles of aggregation and composition in Java using lists and add methods.
Explore aggregation as a has-a ownership relationship in Java, where an aggregating class owns an aggregated object, such as a student with an address or a person with a supervisor.
Explore object oriented design by building a Java course class with a name, a students array, and addStudent, dropStudent, and getStudent method, plus a TestCourse demo.
Design a Java integer stack with push, pop, peek, isEmpty, and size methods, implementing dynamic capacity resizing to accommodate growth.
Wrap primitive values into objects with wrapper classes, and explore numeric wrappers like integer and double, including max/min values and parsing strings in binary, octal, decimal, and hexadecimal.
Explain boxing and unboxing between primitive types and wrapper classes, showing how the compiler automatically boxes and unboxes values, with examples using integers and wrapper classes.
Explore the Java string class, its immutability, and constructors. Learn to replace, split, and match with regular expressions, and convert between strings and char arrays, plus formatting.
Learn how StringBuilder and StringBuffer provide mutable alternatives to strings, using append, insert, replace, reverse, and capacity management, with synchronization for thread safety.
Explore the super keyword and constructor chaining, where a subclass constructor calls its superclass constructor before executing its own tasks, and understand no-argument constructors and default constructors to avoid errors.
Learn how a subclass overrides a superclass method, such as toString in a circle, using super to access the implementation, while noting accessibility, return type compatibility, and static method limits.
Explain how overriding provides a new implementation for a superclass method in a subclass, and how overloading defines same-name methods with different parameter types and the override annotation.
Explain the Object class as the root of all classes, show how the default toString prints the class name and memory address, and demonstrate overriding toString for meaningful object representations.
Dynamic binding selects the correct method at runtime by using the declared type and the actual type, traversing the class hierarchy to find the overridden implementation.
Explain how the object's equals method works to compare by reference and by content, and show overriding equals in a circle class to compare radii.
Introduces the ArrayList class for storing objects with generics, demonstrates adding, removing, and querying size, contains, indexOf, isEmpty, and inserting at an index, with forward and reverse iteration.
Explore how to use the ArrayList class to collect integers from user input until zero, avoid duplicates with contains, and display elements with for or for-each loops, contrasting with arrays.
Learn key Java list operations: create string arrays, sort elements with the Collections.sort method, find max and min values, and shuffle elements. See practical examples and API usage.
Java programming tutorial teaches designing a stack class for holding objects, implementing methods such as isEmpty, size, peek, pop, push, and search, with a test demonstrating usage.
Explore how private, protected, default, and public modifiers govern access to data fields and methods across classes, packages, and subclasses, including when to use protected access.
Learn how the final modifier prevents extension and method overriding in Java, as shown with a final maths class and final methods that cannot be overridden by subclasses.
Java is a great programming language. In the turbulent development of computer technology, Java is everywhere and extremely powerful.
In 1995, Java Applet enabled Web pages to deliver exciting and interactive multimedia content, which facilitating the Web flourishing.
Then with the development of the Web, the Web application became the mainstream way of developing large-scale application.
Java relied on "Compile once, run everywhere" feature to support the cross-platform capabilities which is required by Internet applications and becomes the mainstream language for server-side development.Java EE is still the most important enterprise development platform of the server-side.
Now we are in the era of mobile Internet, and Java is still the deserved leading programming language.
Applications such as Android development, cloud computing, big data, the Internet of Things, and wearable devices all require a distributed computing environment that can be cross-platform and cross-device. We will still see the key role of the Java programming language.
Java is a classic object-oriented programming language with elegant and concise syntax and a rich and useful class library which allows programmers to focus as much as possible on problem solving in the business world.
Many open source projects and prototype systems in research are implemented in Java. The language is so widely used ,it will directly help students in their future research and work. This tutorial has a comprehensive knowledge, clear architecture, a large selection of examples and a large number of well-designed exercises.
This tutorial takes a foundation-first approach, starting with the basics of programming, gradually introducing object-oriented thinking, and finally introducing the application framework, which is very suitable for students who are getting started with programming.
In addition, the emphasis on problem-oriented teaching methods is the key feature of this tutorial, which is the teaching method I have been following in this course.
The best way to teach programming is by example , and the only way to learn programming is by doing .
Teaching students to learn programming courses through vivid and practical examples, avoid boring grammar learning which allowing students to apply what they have learned.
The most important part of the programming course is to develop students' computational thinking. Mastering the thinking of programming, you can easily learn and use other programming languages.
Finally, I wish everyone a happy study.