--Your friends at LectureNotes

Note for Java Programming - JAVA By Amity Kumar

  • Java Programming - JAVA
  • Note
  • Amity University - AMITY
  • Computer Science Engineering
  • 11 Topics
  • 347 Offline Downloads
  • Uploaded 1 year ago
0 User(s)
Download PDFOrder Printed Copy

Share it with your friends

Leave your Comments

Text from page-2

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

Text from page-3

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

Text from page-4

• 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

Text from page-5

2. Variables and Data Types • Variables are locations in memory in which values can be stored. They have a name, a type, and a value. • Java has three kinds of variables: instance variables, class variables, and local variables. • Instance variables, are used to define attributes or the state for a particular object. Class variables are similar to instance variables, except their values apply to all that class's instances (and to the class itself) rather than having different values for each object. • Local variables are declared and used inside method definitions, for example, for index counters in loops, as temporary variables, or to hold values that you need only inside the method definition itself Variable declarations consist of a type and a variable name: Examples : in t myA ge; St ri n g my N a me; boolean isTired; 2.1 Integer types. T y pe Si z e R a ng e byte 8 bits —128 to 127 short 16 bits —32,768 to 32,767 int 32 bits —2,147,483,648 to 2,147,483,647 —9223372036854775808 to 9223372036854775807 long 64 bits 2.2 Floating-point This is used for numbers with a decimal part. Java floating-point numbers are compliant with IEEE 754 (an international standard for defining floating-point numbers and arithmetic). Page 3

Lecture Notes