Don’t watch the clock; do what it does. Keep going.
--Your friends at LectureNotes

Note for Java Programming - JAVA By arjun Rajanala

  • Java Programming - JAVA
  • Note
  • Osmania university - Mjcet
  • Computer Science Engineering
  • 7 Topics
  • 176 Offline Downloads
  • Uploaded 1 year ago
Arjun Rajanala
Arjun Rajanala
0 User(s)
Download PDFOrder Printed Copy

Share it with your friends

Leave your Comments

Text from page-1

PROGRAMMING IN JAVA Introduction: Java Essentials, JVM, Java Features, Creation and Execution of Programs, Data Types, Type Conversion, Casting, Conditional Statements, Loops, Branching Mechanism, Classes, Objects, Class Declaration, Creating Objects, Method Declaration and Invocation, Method Overloading, Constructors– Parameterized Constructors, Constructor Overloading, Cleaning-up unused Objects, Class Variables & Methods-static Keyword, this Keyword, OneDimensional Arrays, Two-Dimensional Arrays, Command-Line Arguments, Inner Class. Inheritance: Introduction, Types of Inheritance, extends Keyword, Examples, Method Overriding, super, final Keywords, Abstract classes, Interfaces, Abstract Classes Verses Interfaces. Introduction of Java Java is a high-level programming language created by James Gosling from Sun Microsystems (Sun) in 1991. The target of Java is to write a program once and then run this program on multiple operating systems. The first publicly available version of Java (Java 1.0) was released in 1995 and latest version of Java 10.0. Sun Microsystems was acquired by the Oracle Corporation in 2010. Oracle has now the steer man ship for Java. In Java 3 types of Kits available (a)J2SE (Java 2Standard Edition) (b)J2ME (Java2 Micro Edition) (c)J2EE(Java 2 Enterprise Edition) Features of Java They are also known as java buzzwords. 1. Object-Oriented 2. Platform independent 3. Simple 4. Secured 5. Robust 1 Arjun Rajanala

Text from page-2

PROGRAMMING IN JAVA 6. Architecture neutral 7. Portable 8. Dynamic 9. Interpreted 10. High Performance 11. Multithreaded 12. Distributed 1. Object Oriented:-Object means a real word entity such as pen, chair, table etc. Object-Oriented Programming is a methodology or paradigm to design a program using classes and objects. It simplifies the software development and maintenance by providing some concepts:A) Inheritance. B) Polymorphism. C) Abstraction. D) Encapsulation 2. Platform independent:-Java runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX. 3. Simple:-Java was designed to be easy for the professional programmer to learn and use effectively. If you already understand the basic concepts of objectoriented programming, learning Java will be even easier. Best of all, if you are an experienced C++ programmer, moving to Java will require very little effort. Because Java inherits the C/C++ syntax and many of the object-oriented features of C++, most programmers have little trouble learning Java. 4. Secured:-Java is secured because: i) No explicit pointer ii) Programs run inside virtual machine sandbox. 5. Robust:-Robust simply means strong. Java uses strong memory management. There are lack of pointers that avoids security problem. There is automatic garbage collection in java. There is exception handling and type checking mechanism in java. All these points makes java robust. 2 Arjun Rajanala

Text from page-3

PROGRAMMING IN JAVA 6. Architectural- neutral:-There is no implementation dependent features e.g. size of primitive types is set. 7. Portable:- We may carry the java bytecode to any platform. 8. Dyanamic:- Java programs carry with them substantial amounts of run-time type information that is used to verify and resolve accesses to objects at run time. This makes it possible to dynamically link code in a safe and expedient manner. This is crucial to the robustness of the Java environment, in which small fragments of byte code may be dynamically updated on a running system. 9. Interpreted:- As described earlier, Java enables the creation of cross-platform programs by compiling into an intermediate representation called Java byte code. This code can be executed on any system that implements the Java Virtual Machine. Most previous attempts at cross-platform solutions have done so at the expense of performance. 10. High Performance:- Java is faster than traditional interpretation since byte code is "close" to native code still somewhat slower than a compiled language (e.g., C++) 11. Multi-threaded:- A thread is like a separate program, executing concurrently. We can write Java programs that deal with many tasks at once by defining multiple threads. The main advantage of multi-threading is that it shares the same memory. Threads are important for multi-media, Web applications etc. 12. Distributed:- We can create distributed applications in java. RMI and EJB are used for creating distributed applications. We may access files by calling the methods from any machine on the internet. 3 Arjun Rajanala

Text from page-4

PROGRAMMING IN JAVA C++ Platformindependent Java C++ is platform-dependent. Java is platform-independent. Mainly used for C++ is mainly used for system programming. Java is mainly used for application programming. It is widely used in window, web-based, enterprise and mobile applications. Goto C++ supports goto statement. Java doesn’t support goto statement. Multiple inheritance C++ supports multiple inheritance. Java doesn’t support multiple inheritance through class. It can be achieved by interfaces in java. Operator Overloading C++ supports operator overloading. Java doesn’t support operator overloading. C++ supports pointers. You can write pointer program in C++. Java supports pointer internally. But you can’t write the pointer program in java. Compiler and Interpreter C++ uses compiler only. Java uses compiler and interpreter both. Call by Value and Call by reference C++ supports both call by value and call by reference. Java supports call by value only. There is no call by reference in java. Structure and Union C++ supports structures and unions. Java doesn’t support structures and unions. Thread Support C++ doesn’t have built-in support for threads. Java has built-in thread support. C++ supports virtual keyword so that we can decide whether or not override a function. Java has no virtual keyword. We can override all non-static methods by default. In other words, non-static methods are virtual by default. Pointers Virtual Keyword 4 Arjun Rajanala

Lecture Notes