You don’t have to be great to start, but you have to start to be great.
--Your friends at LectureNotes

Note for Java Programming - JAVA By Nisha Kadhar

  • Java Programming - JAVA
  • Note
  • 8 Topics
  • 1 Offline Downloads
  • Uploaded 9 months ago
0 User(s)
Download PDFOrder Printed Copy

Share it with your friends

Leave your Comments

Text from page-1

Java Programming Prepared by M.Ameerunnisa Begam MCA., PARVATHY’S ARTS AND SCIENCE COLLEGE DEPARTMENT OF COMPUTER SCIENCE Class: III – B.Sc. IT Semester: V JAVA PROGRAMMING – SNTGC53 SYLLABUS UNIT I: Introduction : Features of Java Language – Types of Programs – Java Architecture – Literals – Data types – Variables – Structure of Java Program – Comments – Expression and Statements – Type Conversion – Arithmetic Operators – Bitwise Operators – Relational Operators – Logical Operator – Ternary Operator – Operator Precedence. UNIT II: Control Structure and Arrays: If…else Statement – Switch Statement – while Statement – do…while Statement – for Statement – Break in Loop – One Dimensional Array – MultiDimensional Array. UNIT III: Class and Interface: Definition – new operator and objects – dot operator – Method Declaration and Calling – Constructors – Instance Variable – this in Constructor – Method Overloading – Passing Objects as Parameters – Sub Class – Method Overriding – Final Class – Method – Variable – Object destruction – Static Class – Method – Variable – Abstract Class – Package – Import Statement – Access modifier – Interfaces. UNIT IV: String, Wrapper & Exception classes: Number Class – Character Class – Boolean Class – String Class – String Buffer Class – Types Of Exception – Catching Exception – Rethrowing Exception – User Exception – Finally Block – Checked and Unchecked Exceptions. UNIT V: I/O and Multithreading: I/O Streams – File Class – Byte Stream – Disk File Handling – Memory Handling – Filtered Byte Stream – Random access File – Character Stream – Multithreading – Creations – Thread States – Multithreaded Programming – Thread Priorities – Waiting For Thread – Join Method – Controlling Threads. 1

Text from page-2

Java Programming Prepared by M.Ameerunnisa Begam MCA., UNIT - I Introduction : Features of Java Language – Types of Programs – Java Architecture – Literals – Data types – Variables – Structure of Java Program – Comments – Expression and Statements – Type Conversion – Arithmetic Operators – Bitwise Operators – Relational Operators – Logical Operator – Ternary Operator – Operator Precedence. 1. INTRODUCTION JAVA was developed by Sun Microsystems Inc in 1991, later acquired by Oracle Corporation. It was developed by James Gosling and Patrick Naughton. It is a simple programming language. Writing, compiling and debugging a program is easy in java. It helps to create modular programs and reusable code. 2. FEATURES OF JAVA LANGUAGE Java language has some special features, using which programmers can write fast, complex, safe and robust programs. Some of such important features are: Safe Java does not provide any pointers like in C or C++. Hence, the memory locations of a system cannot be accessed through a Java program. Therefore, any program developed in Java cannot be used to hack a system. Robust Errors that occur at runtime can be handled easily in Java. Java provides exception handling feature to overcome many runtime problems, like divide by zero, memory out of range, input-output, file not found, etc. Using this feature, a user can properly exit or come out smoothly without the program hanging. Multithreaded Java language provides an environment by which several tasks can be initiated and managed easily. Such a feature is called multithreading. Architecture Neutral A program written and compiled in one platform can run on any other platform running under any type of operating system. Internet Ready Java has the capability to handle TCP/IP packets. Hence Java can be used for internet application. It has several classes for internet programming which can be used for client/server programming. 2

Text from page-3

Java Programming Prepared by M.Ameerunnisa Begam MCA., Simple Many authors of Java have quoted that Java language is simple to learn. No, Java is not that much simple to learn. It is because the capabilities of Java tools are high and one needs to put an effort to understand the Java programming concepts and use them. 3. TYPES OF JAVA PROGRAMS Using Java language, two types of programs can be written. They are: Application Program Java can be used for writing programs that run in a PC under the control of the operating system in that machine. Such programs are termed as application programs. Applet Programs can be written and compiled to give what is called bytecodes. These bytecodes can be downloaded mostly from a remote server and executed without any control from the local operating system. Such programs are called applets. 4. JAVA ARCHITECTURE Java programming environment is based on the following four technologies:  Java programming language  Java class files  Java Application Programming Interface (API)  Java Virtual Machine (JVM) The Java source program is created using the features of Java language. The source program is then compiled using the Java compiler, javac, supplied in Java Development Kit (JDK). After compilation, Java class files are created. These class files are in the form of bytecode. These bytecodes can be in the same machine (in application program) or may travel across the network (in applet) and reach the local machine. The Java Virtual Machine executes Java class files and Java API class files as required for Java class files. The API class files have Java native methods that interact with the local operating system. The JVM is a virtual computer developed in software. The combination of JVM and API is called Java platform 3

Text from page-4

Java Programming Prepared by M.Ameerunnisa Begam MCA., Figure 1.1 Java Architecture The Java platform is different for different machines. Java platform for Unix, Windows, Macintosh, etc. are different from one another. It is this architecture that makes a Java program to write once, compile once and run in any platform. The variation in the hardware environment is taken care by different JVMs for different machines, leaving the source program compatible to all types of machines. Hence, a Java program becomes platform independent (see fig.1.2). Figure 1.2 Platform Independent Java Program 5. LITERALS Entities that do not change their values in a program are called constants or literals. Java provides different literal representations for them. 5.1 Integer Literals A whole number is called integer. 4

Lecture Notes