Description
Course Organization
People
• Teachers:
• Prof. Abir Das
• Prof. Sourangshu Bhattacharya
• Teaching Assistants:
• Owais Iqbal
• V Nikhil Reddy
• Uppada Vishnu
• Nilesh Laad
• Aakash Naik
• Omprakash Chakraborty
Course Conduction
• 3 class tests
• Time bound.
• No discussion.
• Zero in the test if found communicating.
• 6 – 7 assignments
• Discussion allowed
• Grading: 60 assignment + 40 Tests
Course Conduction
• Class – all discussions and announcement will be done
on Teams.
• Must join the Teams meeting – attendance will be taken.
• Assignments
• Assignments will be floated on moodle.
• Individually done if not explicitly mentioned a group assignment.
assignments.
• Class Tests:
• Conducted on moodle online.
Schedule
Dates Activity Topic
Schedule
Dates Activity Topic
Crash course on Java
Content
• “Hello World” program example and running
• Java language Syntax
• Inheritance
Java programming Language
• Some buzzwords for Java
• “Write Once, Run Anywhere”
• Simple
• Object oriented
• Distributed
• Multithreaded
• Dynamic
• Architecture neutral
• Portable
• High performance
• Robust
• Secure
10
Example: Hello World Program
• Everything is in a class
• One file, one public class • In the runnable public class:
• public static void main(String [] args)
Running Java Progs.
• Download eclipse: https://www.eclipse.org/downloads/
• Create new project
• Write your program here
Primitive Data Types
• Primitive Data Types: byte, short, int, long, float, double, boolean, char • Arrays are also a class long a [] = new long[5];
• You can get the length by visiting the length field of array object a, like this: a.length
• String class is very commonly used to represents character strings, for example
String s1 = “Hello ”, s2 = “World!”;
String s3 = s1 + s2;
Operators (same as C/C++)
• ++,– Auto increment/decrement
• +,- Unary plus/minus
• *,/ Multiplication/division
• % Modulus
• +,- Addition/subtraction
Declaring Variables
int n = 1; char ch = ‘A’;
String s = “Hello”; Long L = new Long(100000); boolean done = false;
final double pi = 3.14159265358979323846; Employee joe = new Employee(); char [] a = new char[3]; Vector v = new Vector();
Compared with C/C++
• Java has no:
• pointers
• typedef
• preprocessor
• struct
• unions
• multiple inheritance
• goto
• operator overloading
• malloc
• …
Declaring a class
Inheritance in Java
• Java classes can be derived from other classes, thereby inheriting fields and methods from those classes.
Common Root: Object
Interface
“Multiple Inheritance”
A Real World Example: ArrayList
http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html
Example problem
• You have a set of acquaintances.
• The acquaintances are of types: personal friends and
professional friends.
• For all acquaintances, you need to remember the name,
mobile number, and e-mail.
• For personal friends, you would be interested to remember the birth day.
• For professional friends, you would like to remember the
specific common professional interests (100 chars max). • You should be able to perform the following:
• Create and delete various types of acquaintances.
• Display the entire list of acquaintances.
Program
Program
Program
Program
Program
Reviews
There are no reviews yet.