Course Material BSIT Department
Introduction to Java
Programming
CCPRGG2L - Intermediate
Programming
Course Material BSIT Department
Objectives
At the end of the discussion, each students will be able to:
• Understand Java's history, milestones, features, and real-
world applications.
• Set up a Java development environment by installing the
JDK and configuring an IDE
• Write, compile, and execute simple Java programs, applying
proper syntax and structure.
Course Material BSIT Department
Overview of Java
• Java is a high-level, class-based, object-oriented programming language that is
designed to have as few implementation dependencies as possible.
• It is a general-purpose programming language that follows the principle of "write
once, run anywhere" (WORA).
• This means that compiled Java code can run on all platforms that support Java
without the need for recompilation.
• Java was developed by James Gosling, Mike Sheridan, and Patrick Naughton at
Sun Microsystems in 1991 and which was acquired by Oracle Corporation on 2010
• The language was initially called "Oak" after an oak tree that stood outside
Gosling's office.
• It was later renamed "Java" after the Indonesian coffee.
Course Material BSIT Department
Milestone of Java
• 1991: The project was initiated by James Gosling and the Green Team at
Sun Microsystems. It was originally designed for interactive television, but
it was too advanced for the digital cable television industry at the time.
• 1995: Java was officially launched. The first public implementation was
Java 1.0, which was released with the slogan "Write Once, Run Anywhere"
(WORA). This version provided a stable environment for developers to write
code that could be executed on any machine that had the Java Runtime
Environment (JRE).
• 1997: The Java Development Kit (JDK) 1.1 was released, which included
significant updates like the JDBC API, the JavaBeans component model,
and inner classes.
• 1999: Sun Microsystems released Java 2 (also known as J2SE 1.2), marking
the beginning of the three-edition platform: J2SE (Java 2 Standard Edition),
J2EE (Java 2 Enterprise Edition), and J2ME (Java 2 Micro Edition). This
version introduced the Swing graphical API and the Collections framework.
Course Material BSIT Department
Milestone of Java
• 2004: Java 5.0 (formerly known as J2SE 1.5) was released, introducing
major updates like generics, metadata, enumerated types, and the
enhanced for loop.
• 2006: Sun Microsystems released Java under the GNU General Public
License (GPL), making it free and open-source software. This led to the
development of the OpenJDK, an open-source implementation of the
Java platform.
• 2009: Oracle Corporation acquired Sun Microsystems, and with it, Java.
Oracle continues to develop and support Java.
• 2014: Java 8 was released, which included features like lambda
expressions, the Stream API, and the new date and time API.
• 2017: Oracle announced that Java would switch to a new release
cadence, with new versions being released every six months. This led to
the rapid introduction of features in subsequent versions.
Course Material BSIT Department
Course Material BSIT Department
Milestone of Java
Present: Java continues to evolve, with the latest versions
introducing new features and enhancements. The language is
still widely used in various domains, including web development,
mobile applications, and large-scale enterprise systems.
It is used for:
• Mobile applications (specially Android apps)
• Desktop applications
• Web applications
• Web servers and application servers
• Games
• Database connection
Course Material BSIT Department
Real – world Applications of Java
Java is used in various domains
due to its versatility and platform
independence.
Here are some examples of real-
world applications:
• Web Applications:
Java is extensively
used for building
server-side
applications.
Frameworks like
Spring, Hibernate, and
Struts are commonly
used in web https://spring.io/projects/spring-framework
development.
Course Material BSIT Department
Real – world Applications of Java
Java is used in various domains due to its versatility and platform independence.
Here are some examples of real-world applications:
• Web Applications:
https://github.com/vedantkadam/Shopping-Cart-App-Java
Course Material BSIT Department
Real – world Applications of Java
Java is used in various domains due to its versatility and platform independence.
Here are some examples of real-world applications:
• Enterprise Applications: Java is widely used in large-scale enterprise
systems due to its robustness, scalability, and security features. Java EE
(now Jakarta EE) is specifically designed for building distributed, multi-
tiered, transactional applications.
Course Material BSIT Department
Real – world Applications of Java
Java is used in various domains due to its versatility and platform independence.
Here are some examples of real-world applications:
• Mobile Applications: Most Android applications are either written in Java
or use Java as one of the core languages.
Course Material BSIT Department
Real – world Applications of Java
• Big Data Technologies: Java is used in big data technologies like
Apache Hadoop, Apache Spark, and others.
Course Material BSIT Department
Real – world Applications of Java
• Scientific Applications: Java is used in various scientific
applications for data processing, mathematical calculations, and
simulations.
Course Material BSIT Department
Real – world Applications of Java
• Gaming: Java is used in developing 2D and 3D games, as well as
mobile games.
Course Material BSIT Department
Real – world Applications of Java
• Cloud Computing: Java is used in cloud computing platforms like
AWS, Google Cloud, and Azure for developing scalable and
distributed systems.
Course Material BSIT Department
References:
• https://www.linkedin.com/pulse/applications-java-real-world-
examples-sathish-
kumar#:~:text=Examples%20of%20web%2Dbased%20applicatio
ns%20are%20irctc.co.in%2C%20online,Google%20Sheets%2C%
20Google%20Slides%20and%20many%20more.
Course Material BSIT Department
Install and Set-up
To start programming in Java, you need to set up your development environment. This involves installing
the Java Development Kit (JDK) and setting up an Integrated Development Environment (IDE) for writing and
running Java code.
1. Downloading and Installing JDK
2. Visit the Oracle JDK Download Page: Go to the official Oracle website or OpenJDK to download the
latest version of the JDK.
3. Choose the Appropriate Version: Select the appropriate JDK version based on your operating system
(Windows, macOS, or Linux).
4. Install the JDK:
1. For Windows:
1. Download the installer (.exe file).
2. Run the installer and follow the instructions.
3. The installer will automatically set up the JDK and configure the necessary environment
variables.
2. For macOS:
1. Download the .dmg file.
2. Open the .dmg file and drag the JDK package to the Applications folder.
1. For Linux:You can install OpenJDK using the package manager. For example, on
Ubuntu, you can use the following command: sudo apt update
sudo apt install openjdk-17-jdk
Course Material BSIT Department
Setting-up Path Environment
To start programming in Java, you need to set up your development environment. This involves installing
the Java Development Kit (JDK) and setting up an Integrated Development Environment (IDE) for writing and
running Java code.
1. Downloading and Installing JDK
2. Visit the Oracle JDK Download Page: Go to the official Oracle website or OpenJDK to download the
latest version of the JDK.
3. Choose the Appropriate Version: Select the appropriate JDK version based on your operating system
(Windows, macOS, or Linux).
4. Install the JDK:
1. For Windows:
1. Download the installer (.exe file).
2. Run the installer and follow the instructions.
3. The installer will automatically set up the JDK and configure the necessary environment
variables.
2. For macOS:
1. Download the .dmg file.
2. Open the .dmg file and drag the JDK package to the Applications folder.
1. For Linux:You can install OpenJDK using the package manager. For example, on
Ubuntu, you can use the following command: sudo apt update
sudo apt install openjdk-17-jdk
Course Material BSIT Department
Installing IDE
While you can write Java code in a simple text editor, using an Integrated
Development Environment (IDE) greatly enhances productivity.
Popular Java IDEs include:
• Eclipse: A widely used, open-source IDE with powerful
features for Java development.
• IntelliJ IDEA: A popular IDE from JetBrains, known for its
advanced code editing and refactoring features.
• NetBeans: Another open-source IDE that is easy to use and
comes with built-in support for Java SE, Java EE, and more.
Course Material BSIT Department
Installation Steps
Installation Steps:
1. Download the IDE: Visit the official website of the IDE
and download the installer for your operating system.
2. Install the IDE: Run the installer and follow the
instructions to complete the installation.
3. Set Up the IDE:
1. Configure the IDE to use the installed JDK.
2. Create a new Java project to get started with Java
programming.
Course Material BSIT Department
Writing & Running a Simple Java
Program
Open your IDE and create a new Java project.
Create a New Java Class:
• Name the class HelloWorld.
• Write the following code in the HelloWorld.java file:
Code:
Output:
Course Material BSIT Department
Java Syntax and Structure
Basic Structure of a Java Program
•Main method: Every Java application must have a main() method that
acts as the entry point.
•public static void main(String[] args)
•This method is executed when the Java application starts
Course Material BSIT Department
References
[1] Burd, B. (2021). Beginning Programming with Java for Dummies. (6th ed.).
[2] Clark, N. (2021). Computer programming for beginners: fundamentals of programming terms
and concepts. (2nd ed.).
[3] Crutcher, P. (2021). Essential computer science: a programmer’s guide to foundational
concepts.
[4] Ellison, B. (2022). Java for Beginners: A Crash Course to Learn Java Programming in 1
Week (Programming Languages for Beginners).
[5] Sebesta, R. (2020). Concepts of Programming Languages. (11th ed.)