What is java?
- Developed by Sun Microsystems ( by James Gosling)
- A general-purpose object-oriented language(while C++ is procedural plus object oriented)
- Based on C/C++
- Designed for easy Web/Internet applications
Java Features:
Note: features are always asked by interviewer
- Java is Simple:
- Fixes some clumsy features of C++
- No pointers
- Automatic garbage collection
- Rich pre-defined class library
- Focus on the data (objects) and methods manipulating the data
- All functions are associated with objects
- Almost all data-types are objects (files, strings, etc.)
- Potentially better code organization and reuse
3.Interpreted:
- Java compiler generate byte-codes(and not native machine code which is happens in C,C++)
- The compiled byte-codes are platform-independent
- Java byte-codes are translated on the fly to machine readable instructions at run-time (by Java Virtual Machine)
- Same application can run on all platforms
- The sizes of the primitive data types are always the same
- The libraries define portable interfaces
- Extensive compile-time and run-time error checking
- No pointers but real arrays. Memory corruptions or unauthorized memory accesses are impossible
- Automatic garbage collection tracks objects usage over time
- Usage in networked environments requires more security
- Memory allocation model is a major defense
- Access restrictions are forced (private, public)
- multiple concurrent threads of executions can run simultaneously
- utilizes a sophisticated set of synchronization primitives (based on monitors and condition variables paradigm) to achieve this
- Java is designed to adapt to evolving environment
- Libraries can freely add new methods and instance variables without any effect on their clients
- Interfaces promote flexibility and reusability in code by specifying a set of methods an object can perform, but leaves open how these methods should be implemented
- Can check the class type at run-time.
0 comments:
Post a Comment