BOLD. ⢠All keywords should be written by using all small letters as follows: public ..... .
[Java Index] S. No.
Topic
Page No.
1. 2. 3. 4. 5 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20.
Certificates and Acknowledgement Introduction to Java Features of Java Introduction to JVM (Java Virtual Machine) Naming Conventions in Java Programming Introduction to OOPs Features of OOPs Classes and Object in Java Program to show the use of Class and Object Encapsulation Program to show the Encapsulation feature Abstraction Program to show the Abstraction feature Inheritance Program to show the Inheritance feature Polymorphism Program to show the Polymorphism feature Abstract Class and Interface class Program based on Abstract Class Program based on Interface Some Basic Java Program based on Assignment Program to find the greatest number by using ( ?,: ) Operator. Program to find the factorial of any number. Program to find the number of prime integer between given range. Program to find the leap year. Program to print Fibonacci series using recursion. Coding for Package in Java Coding for Exception Handling in Java Coding for Files Creation and Manipulation Coding for Graphical Programming using AWT in Java Coding for Applet in Java
i 1 2 3 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 14 14
21. 22. 23. 24. 25. 26. 27. 28. 29. 30.
15 16 17 18 19 20 21 22 23
For Study Material: http://www.niomsolution2000.blogspot.com
Date
Page |1
Introduction to Java – Sun Microsystems Inc. (US) was conceived a project to develop software for consumer electronic devices that could be controlled by a remote. This project was called Stealth Project but later its name was changed to Green Project. In January of 1991, James Gosling and his colleagues thought C and C++ could be used to develop the project. But the problem they faced with them is that they were system dependent language and hence could not be used on various processors, which the electronic devices might use. So he started developing a new language, which was completely system independent. This language was initially called Oak. Since this name was registered by some other company, later it was changed to Java. By September of 1994, Naughton and Jonathan Payne started writing WebRunner – a Java-based Web browser, which was later renamed as HotJava. By October 1994, HotJava was stable and was demonstrated to Sun executives. HotJava was the first browser, having the capabilities of executing applets, which are programs designed to run dynamically on Internet. This time, Java’s potential in the context of the World Wide Web was recognized.
For Study Material: http://www.niomsolution2000.blogspot.com
Page |2
Features of Java – There are following features of Java which make Java programming much reliable. Simple: Java is a simple Programming language. Rather than feature simplicity of this programming design is the objective to cover huge number of devices. First of all, the difficult concepts of C and C++ have been omitted in Java. Object – Oriented: Java is an object-oriented programming language. This means Java programs use objects and classes. An object is anything that really exists in the world and can be distinguished from others. Everything that we see physically will come into this definition, for example, every human being, a book, a tree, and so on. Distributed: Information is distributed on various computers on a network. Robust: Robust means strong. Java programs are strong and they don’t crash easily like a C or C++ program. Secure: Security problems like eavesdropping, tampering, impersonation, and virus threats can be eliminated or minimized by using Java on Internet. System Independence: Java’s byte code is not machine dependent. It can be run on any machine with any processor and any operating system. Portability: If a program yields the same result on every machine, then that program is called portable. Java programs are portable. This is the result of Java’s System Independence nature.
For Study Material: http://www.niomsolution2000.blogspot.com
Page |3
Introduction to JVM (Java Virtual Machine) – Java Virtual Machine (JVM) is the heart of entire Java program execution process. It is responsible for taking the .class file and converting each byte code instruction into the machine language instruction that can be executed by the microprocessor. Architecture of Java Virtual Machine.
Class loader sub system
Class File
Method area
Heap
Java Stacks
PC Registers
Native method stacks
Runtime ; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter range to which prime number should print: "); userNumber=Integer.parseInt(br.readLine()); for(i=1;i=1;num--) { if(i%num==0) { counter = counter + 1; } } if(counter == 2) { primeNumber=primeNumber + i + " "; } } System.out.println("Prime Number from 1 to 100 are : "); System.out.println(primeNumber); } }
For Study Material: http://www.niomsolution2000.blogspot.com
P a g e | 17
Program to find the leap year.
import java.io.*; class LeapYear { public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter your Year: "); int year = Integer.parseInt(br.readLine()); boolean isLeapYear = false; if(year % 400 == 0) { isLeapYear=true; } else if(year % 100 == 0) { isLeapYear = false; } else if(year % 4 == 0) { isLeapYear = true; } else { isLeapYear = false; } if(isLeapYear)
For Study Material: http://www.niomsolution2000.blogspot.com
P a g e | 18
{
} else {
}
Year"); } }
System.out.println("Year" + year+" is a Leap Year"); System.out.println("Year "+year+" is not a Leap
Program to Print Fibonacci Series in given range
import java.util.Scanner; class Fibonacci { public static void main(String args[]) { System.out.print("Enter number upto which Fibonacci series to print: "); int number = new Scanner(System.in).nextInt(); System.out.println("Fibonacci series upto " + number + " numbers: "); for(int i=1; i