Core Java in a simplified and stepwise manner. The focus behind this book is to make learning Java easy by choosing small programs and their detailed explanation. This book is written keeping in mind the difficulties students face when they start learning programming in Java. Chapter 1 “Java Basics” covers the initial concepts of platform independence, Java environment and installation, writing and saving a Java program, steps to execute and command line arguments. Chapter 2 “Java Object Oriented –Basics” explains the OOPS concepts and their implementation in Java like classes, objects, methods, constructors, method overloading etc. This chapter includes some program based problems to understand few compile time errors. Chapter 3 “Java Object Oriented - Advanced”, covers advanced OOPS concepts abstract, dynamic polymorphism, method overriding, static methods/blocks. The concepts have been strengthened with help of programs and their stepwise analysis. Chapter 4 include the introduction of exceptions and error, details on how to implement exception handling constructs try-catch, throw, throws etc. provided by Java with help of various small programs. Chapter 5 is completely devoted to multi-threading and its implementation in Java programs. Use of Thread class and Runnable interface has been explained in detail with example. Emphasis is given on understanding the thread synchronization and concurrency.
Chapter 1: Java Basics
• Java is platform independent. How?
• What all do I require to start with a Java program?
• How a single common .class file can be executed on different machines?
• How can I write and execute a basic Java program?
• A simple basic Java program does not compile. Why?
• How many classes can be written / defined in one single .java file?
• I want to pass some data to a Java program while I executing it. How can that be done?
• An Example. Program 1.8.1 does not get executed successfully. Why?
Chapter 2: Java Object Oriented – Basics
• Java classes - what are they?
• More about methods in a class
• What does a method signature consists of?
• Objects differ from classes. How? How an object be used in a program?
• How to declare and use Constructors
• There is also something called as default constructor. Why do we need it?
• When to declare a variable or a method as static?
• Static methods differ from normal non-static methods. How?
• How to differentiate between class variables and instance variables?
• Method overloading achieves polymorphism. How?
• When name of methods are same in case of method overloading, then how compiler finds that which method to actually call?
• An Example. What is wrong with program 2.12.1?
• Inheritance is important and useful. How?
• How are objects created and initialized in inheritance?
• An Example. Read program 2.15.1. Why does it throw an error?
Chapter 3: Object Oriented Concepts – Advanced
• An Example. Program 3.1.1 does not compile successfully. Why?
• An Example. In Program 3.2.1, class Student has a constructor defined but it has a return type. How the program will behave?
• Can we define a constructor as private? If yes, then why do we need to implement so?
• Dynamic polymorphism is the key to object oriented programming. How to implement the same in Java?
• Can we override static methods?
• A class MyShape is declared as abstract. But there is no abstract method declared in it. Isn’t it compulsory for an abstract class to have an abstract method?
• What is a static block? Is it different than a method?
• Read program 3.8.1. It does not declare the main method as static. How will this program behave?
• An example. Read program 3.9.1. Why there is a compiler error?
Chapter 4: Exceptions
• Errors and Exceptions – what are they? How do they differentiate?
• A simple Java program throwing an exception – An Example
• One more example of Exception
• Java exceptions have types.
• How to handle a Java Exception? The try-catch stuff
• Handle multiple exceptions – A try block with multiple catch blocks
• How a program will behave if an exception is not handled?
• What if we do not want to handle a checked type exception?
• Difference between throw and throws.
• An example. Read the program 4.10.1. It is same as 4.9.1 but it does not compile successfully. Why?
• How to define a custom exception?
Chapter 5: Threads
• Basics of threads, processes and concurrency
• Multithreading and Java basics
• How to create a thread and execute it?
• Two important methods run () and start () – and their significance?
• Why are there two ways to create a thread - Runnable interface vs Thread class? Which one to use to create a thread?
• An Example. Read the program 5.6.1. What would be the output of this program?
• An example. Read the program 5.7.1. What would be the output of this program?
• An example. Read the program 5.8.1. What would be the output of this program?
• Significance of join () method
• What is Thread synchronization?
• How to ensure thread synchronization?
• What if we need to synchronize a static method?
Ms. Neetu Gupta
Ms. Neetu Gupta is masters in computer application and an assistant professor with Amity University Uttar Pradesh, Noida. She has taught programming languages like Java / C++ / C, algorithms, operating system / UNIX etc. to graduate and post graduate students. She has an experience of 17 years in IT industry and academia. Formerly she has worked as a programmer and developed applications in the publishing and finance domain for companies like Headstrong, Noida and Quark, Mohali. She is GATE qualified and presently pursing PhD in Computer Science.
Subject Covers:-
• Java Basics.
• Java Object Oriented – Basics.
• Object Oriented Concepts – Advanced.
• Exceptions.
• Threads
This Book Useful for the students of :-