Week 1 Lec 1 (Java history, procedural vs oop)
Week 1 Lec 1 (Java history, procedural vs oop)
Total 100
Assignments Quizzes
Assignments will be due at the beginning of the class. Under • Oral Quizzes are conducted to check understanding
normal circumstances, late work will not be accepted. of previous lectures before starting the next lecture.
Students are expected to do their own assignments. • Announced quizzes to assess the understanding of
taught topics.
Plagiarism will be observed strictly.
Few Things to Remember
Show sensibility in your conduct.
Learning should be your primary objective.
Attendance will be marked within 10 minutes at the start of the class.
80% of your attendance is mandatory.
Zero tolerance policy on attendance, discipline of class during lectures.
Assignments must be submitted on time, no late submissions.
In case of copied assignment both parties will be given zero.
Don’t miss your Classes, Quizzes, Presentations, Assignments and Projects/Presentations.
You all need to be a good human being.
Recommended Books
1.Java: The Complete Reference by Herbert Schildt latest edition
2.Java How to program , Eigth Edition, by Deitel and Deital
3.Case Studies and other related material will be provided during the course.
Course Overview
▪An Overview of Object Oriented ▪ Java Packages
Programming and Java
▪ Arrays and Java Collections
▪ Fundamental Programming Structure
in Java ▪ Introduction to GUI
▪ Layouts and event Handling
▪ Introducing Classes
▪ Exception Handling
▪Constructors in Java
▪ Threads in java
▪Inheritance ▪ File handling and Database
▪Polymorphism connectivity
▪Dynamic Memory Allocation
Topics To be Covered Today
What is a Program?
Evolution of Programming Languages
Why Java?
Java History
Features of Java
Procedural vs object oriented programming language.
Java Procedure
CLO Covered
CLO1: Understand the underlying concepts of
object-oriented paradigm.
What is a Program?
A computer program (also a software program, or just a program) is a sequence of
instructions written to perform a specified task for a computer.
Programming Language
The definition of programming language states;
“any kind of language that is used to do computational tasks
on the computer and written to produce some output after
doing computations is called programming language”.
The Evolution of Programming Languages
1. Machine language: 1940’s
2. Assembly language: early 1950’s
3. Higher-level languages: late 1950’s
4. Today: thousands of programming languages
What is Programming?
When we say “programming” we are actually referring to the
science of transforming our intentions in a high-level programming
language.
It is the process of creating a set of instructions that tell a computer
how to perform a task.
What are we doing in this course?
There is a proper way or format or structure available to write programming tasks using
various languages. This way of writing programs using the proper format is called
programming paradigms.
Paradigms is also called programming design philosophy. Various programming
paradigms are available through which we can write our programs. Three main
programming paradigms are:
▪ Object-Oriented Programming Model
▪ Procedural-Oriented Programming Model
▪ Functional Programming Model
Debuggers: Allows a programmer to run the program to see the execution of the program and correct
any errors.
Integrated Development Environment (IDE): Combines editor, compiler, debugger and profiler or a
subset into one tool.
◦ Common Java IDEs are Eclipse, Netbeans, BlueJ, and DrJava.
Characteristics of the Java PL
Simple
Object oriented
Distributed
Multithreaded
Dynamic
Architecture neutral
Java Procedure
The essential steps to creating and running Java programs go as follows:
◦ Create a Java source code file
◦ Compile the source code
◦ Run the compiled code in a Java Virtual Machine.
Java Procedure Detail
1. You create the code with a text editor (for example
notepad) and save it to a file with the ".java" suffix.
2. All Java source code files must end with this type name.
3. The first part of the name must match the class name in
the source code.
4. In the figure the class name is Test so you must therefore
save it to the file name Test.java.
Java Procedure
Detail
1. With the javac program, you compile this file
as follows:
◦ C:> javac Test.java
Every line of code that runs in Java must be inside a class. In our example, we
named the class Main. A class should always start with an uppercase first letter.
Note: Java is case-sensitive: "MyClass" and "myclass" has different meaning.
The name of the java file must match the class name. When saving the file,
save it using the class name and add ".java" to the end of the filename.
The main Method
Java Output
Note: The curly braces {} marks the beginning and the end of a block of code.
System is a built-in Java class that contains useful members, such as out, which is short
for "output". The println() method, short for "print line", is used to print a value to the
screen (or a file).
Cont..
You can add as many println() methods as you want. Note that it will add a new line for each method: