×
Expect problems and eat them for breakfast.
--Your friends at LectureNotes
Close

Java Programming

by Amity Kumar
Type: NoteInstitute: Amity University Specialization: Computer Science EngineeringOffline Downloads: 214Views: 6222Uploaded: 8 months agoAdd to Favourite

Share it with your friends

Suggested Materials

Leave your Comments

Contributors

Amity Kumar
Amity Kumar
UNIT No. 1 2 3 4 Index Sheet INTRODUCTION TO JAVA Java and Java applications; Java Development Kit (JDK); Java is interpreted, Byte Code. JVM , Object-oriented programming; Simple Java programs Data types and other tokens: Boolean variables, int, long, char, operators, arrays, white spaces, literals, Assigning values ,Creating and destroying objects; Access specifiers. operators and Expressions: Arithmetic Operators, Bitwise operators, Relational operators, The Assignment Operator, The ? Operator; Operator Precedence; Logical expression; Type casting; Strings , Control Statements: Selection statements, iteration statements, Jump Statements CLASSES, INHERITANCE, EXCEPTIONS, APPLETS Classes: Classes in Java; Declaring a class; Class name; Super classes; Constructors; Creating instances of class; Inner classes Inheritance: Simple, multiple, and multilevel inheritance; Overriding, overloading. Exception handling: Exception handling in Java. The Applet Class: Two types of Applets; Applet basics; Applet Architecture; An Applet skeleton; Simple Applet display method Requesting repainting; Using the Status Window; The HTML APPLET tag; Passing parameters to Applets; getDocumentbase() and getCodebase() ApletContext and showDocument(); The AudioClip Interface; The AppletStub Interface; Output to the Console. MULTI THREADED PROGRAMMING, EVENT HANDLING Multi Threaded Programming: What are threads? How to make the classes threadable; Extending threads; Implementing runnable; Synchronization; Changing state of the thread; Bounded buffer problems Read-write problem, producer-consumer problems Page No. 1-12 1 1 3 4 4 6 13-28 13 15 18 20 22 23 29-41 29 30 33 Two event handling mechanisms 35 The delegation event model; Event classes; Sources of events 36 Event listener interfaces; Using the delegation event model 37 Adapter classes; Inner classes 39 SWINGS Swings: The origins of Swing; Two key Swing features 42-49 42 Components and Containers 42 The Swing Packages; A simple Swing Application 45 Create a Swing Applet 46 Jlabel and ImageIcon 47
5 JTextField;The Swing Buttons; JTabbedpane 48 JScrollPane; JList; JComboBox; JTable 49 JAVA 2 ENTERPRISE DATABASE ACCESS: EDITION OVERVIEW, Overview of J2EE and J2SE. 6 50 A Brief Overview of the JDBC process; Database Connection; 50 Associating the JDBC/ODBC Bridge with the Database; 51 Statement Objects ,ResultSet; 52 Transaction Processing Metadata,. Data types; Exceptions. 53 SERVLETS 54-60 Background 54 54 55 Reading Servlet Parameter; The Javax.servlet.http package 56 Handling HTTP Requests and Responses 57 Using Cookies 58 Session Tracking. 59 JSP, RMI Java Server Pages (JSP): JSP, JSP Tags 61-65 Tomcat, Request String, User Sessions 62 Cookies, Session Objects 64 Java Remote Method Invocation: Remote Method Invocation concept Server side 8 50 The Concept of JDBC; JDBC Driver Types; JDBC Packages The Life Cycle of a Servlet; Using Tomcat for Servlet Development; A simple Servlet The Servlet API; The Javax.servlet Package 7 50-53 61 64 65 Client side. 65 KSIMC 65 Dic single windows agency SISI,NSIC,SIDBI,KSFC 65 ENTERPRISE JAVA BEANS Enterprise java Beans; Deployment Descriptors 66-68 66 67 Session Java Bean 67 Entity Java Bean; 67 Message-Driven Bean, The JAR File. 68
UNIT-1 INTRODUCTION TO JAVA 1. Introduction to Java • Java is an object-oriented programming language developed by Sun Microsystems, a company best known for its high-end Unix workstations. • Java is modeled after C++ • Java language was designed to be small, simple, and portable across platforms and operating systems, both at the source and at the binary level (more about this later). • Java also provides for portable programming with applets. Applets appear in a Web page much in the same way as images do, but unlike images, applets are dynamic and interactive. • Applets can be used to create animations, figures, or areas that can respond to input from the reader, games, or other interactive effects on the same Web pages among the text and graphics. 1.1 Java Is Platform-Independent Platform-independence is a program's capability of moving easily from one computer system to another. • Platform independence is one of the most significant advantages that Java has over other programming languages, particularly for systems that need to work on many different platforms. • Java is platform-independent at both the source and the binary level. 1.2 Java Development Kit (JDK)- Byte code • Bytecodes are a set of instructions that look a lot like machine code, but are not specific to any one processor • Platform-independence doesn't stop at the source level, however. Java binary files are also platform-independent and can run on multiple platforms without the need to recompile the source. Java binary files are actually in a form called bytecodes. 1.3 Object-Oriented Programming • Many of Java's object-oriented concepts are inherited from C++, the language on which it is based, but it borrows many concepts from other object-oriented languages as well. Page 1
• Java includes a set of class libraries that provide basic data types, system input and output capabilities, and other utility functions. • These basic classes are part of the Java development kit, which also has classes to support networking, common Internet protocols, and user interface toolkit functions. • Because these class libraries are written in Java, they are portable across platforms as all Java applications are. 1.4 Creating a simple Java Program Hello World example : class HelloWorld { public static void main (String args[]) { System.out.println("Hello World! "); } } This program has two main parts: • All the program is enclosed in a class definition—here, a class called Hello World. • The body of the program (here, just the one line) is contained in a method (function) called main(). In Java applications, as in a C or C++ program, main() is the first method (function) that is run when the program is executed. 1.5 Compiling the above program : • In Sun's JDK, the Java compiler is called javac. javac HelloWorld.j ava • When the program compiles without errors, a file called HelloWorld.class is created, in the same directory as the source file. This is the Java bytecode file. • Then run that bytecode file using the Java interpreter. In the JDK, the Java interpreter is called simply java. java HelloWorld If the program was typed and compiled correctly, the output will be : "Hello World!" Page 2

Lecture Notes