More updates please ping me whats up number 9553667049
Date :04- july-2016
Mr. nagur babu
Difference between
java and others (c & c++)
1.
C and c++ are static
programming languages, but java is a dynamic programming language
If any programming language allowing memory allocation for
primitive data types at compilation time then that programming language is
called as static programming languages
Ex:- c and c++
In c & c++ applications, memory will be allocated for
then primitive data type at compilation time only, not at run time
If any programming language allows memory allocation for the
primitive data types at run time then that type of programming language is
called as Dynamic programming language
Ex:- Java
In java application memory will be allocated for primitive
data types at runtime only, not at compilation time
Note : - in all the programming languages the data type like
byte, short, int, long, float, double, char & Boolean are treated as
“primitive data types”.
2.
Pre-processer is
required in c & c++, but pre-processers is not required in java
In c & c++ the complete predefined library is provided
in the form of “header files”.
Ex:-
Static.h
Conio.h
Math.h
In c & c++ application, if you want to use predefined
library then we have to include the respective header file for this, we have to
use “#include<>”.
Ex:-
#include<stdio.h>
#include<conio.h>
#include<math.h>
If we compile c & c++ programming then pre-processer
will perform the following actions
1.
Pre-processer will recognized #include< > statements
2.
Pre-processers will take the provided header
files and search for then in c and c++ software’s(predefined library ).
3.
If the required header files are available in c
& c++ predefined library then pre-processer will be load the specified
header files content to the memory, this type of loading at compilation time is
called as “static loading”.
Conclusion :-
In c & c++ application, pre-processor is required to
recognize Pre-processer will recognized #include< >
Statements in order to load the specified reader files
content of the memory.
Date :05- july-2016
Mr. nagur babu
In case of java the complete predefined library is provide
in the form of classes and interfaces in packages
Ex:-
Java.io
Java.util
Java.awt
If we want to use predefined library in java applications,
then we have to import the respective package in java files. To import packages
we have to use “import” statement
EX:-
import java.io.*;
import java.util.*;
import.java. awt.*;
if we compile java program then compiler will perform the
following actions
1.
Compiler will recognized import statements.
2.
Compiler will take the provided package name
from import statements.
3.
Compiler will check whether the specified
package are existed (Or) not in java predefined library.
4.
If the specified packages are not existed in
java predefined library the compiler will rise an error like. “package XXX does
not exist”.
5.
If the specified package are existed then
compiler will not rise any errors compiler will not load any package content to
the memory
When we execute java application, when JVM encounter any
class (or) interface then only JVM will load the respective class and interface
to the memory this type of loading at run time is called as “dynamic loading “ .
Why not available pre-processers
Pre-processer is not existed in java, because,
#include<> statements and header files are not existed in java
Java Architecture
Q) what are the difference between #include<> statement
& import statements?
1)
#include<> statement are available up to c
& c++
2)
import statement are available up to java.
3)
#include<> statements are used to include
the predefined library available in the form of header files.
4)
import statements are used to include the
predefined library available in the form of package.
5)
#include<> statements are recognized by
pre-processer.
6)
import statements are recognized by compiler and
JVM.
7)
#include<> statements are providing static
loading.
8)
import statements are providing dynamic loading.
9)
Single #include<> statements is able to
include single header file.
10)
Single import statements is able to include more
then one class or more then one interface of the same package
3.
Java and Others
C & c++ are platform dependent
programming languages, but java is platform independent programming language.
Why we are say
if any programming language allows its
application to compile and execute on the same operating system then that
programming language is called as platform dependent programming language.
Ex:- c & c++
If we compile c program on windows
operating system then compiler will generate a.exe file container executable
code as per windows representation. In this context, if we want to execute
windows represented .exe file then we must provide the same windows operating
system for execution, because, windows representation are compatible with
windows operating system only.
If any programming language allows its
applications to compile on one operating system, and to execute on another
operating system then that programming language is called as “platform
independent” programming language.
Ex:- java
If we compile java program is windows OS
then compilers will generate .class file contains byte code, it is not directly
executable code, it is an intermediate code and it is not having any OS
representations including windows OS representations.
In the above context, to execute java
program in all the OS and to make java programming language as platform
independent programming language, sun micro system has provide a translator to
translate neutral byte code to the local operating system representation called
as “JVM” [java virtual machine].
In java application execution, the role of
JVM is to translate neutral byte code OS representations and to execute
translated code.
Note :-
Java is platform independent programming
language, because of JVMs only, but JVM is platform dependent.
Q) What are the
difference between .exe file and .class file?
Ans);-
1.
.exe file are available up to c and c++
.class file are available up to java
2.
.exe file contains directly executing code.
.class file contains byte code, it is not directly executed code, it is
an intermediate code.
3.
.exe file is platform dependent.
.class file is platform independent.
4.
.exe file is able to allow viruses easily.
.class file is not allowing viruses related software’s.
5.
.exe file is able to provide code security.
.class file is able to provide more security.
1.
Pointer are available in
c and c++ , but pointers are not existed
in java.
Pointer variable is a variable, it also
store address locations and a particular data structure, where data structure
may be a variable, a structure, an array, another pointer variable,…….
In general, pointer variable are recognized
and initialized at the time of compilation.
Pointer variables are not available in
java, because
1.
Pointers variables must required static memory
allocation, but java is following dynamic memory allocation.
2.
Pointer variable are supported by static
programming languages, but java is dynamic programming languages.
3.
Pointer variable very much of suitable to
platform dependent programming language, but java is platform independent
programming language.
4.
Pointer variable are able to reduce security for
the application data. But java is very good secured programming language, java
has to provide very good security for the application data.
5.
Pointer are able to increase confusion to the
developers, but java is very simple programming language, it should not provide
confusion to the developers.
Q) What are the difference between pointer
variables and reference variable?
Ans ):-
1.
Pointer variable is available up to a and c++
mainly reference variable is able to up to java mainly
2.
Pointer variable are able to refer a block of
memory by storing its address location.
Reference variable are able to refer a
block of memory (Object) by storing object reference value.
Note :-
Object reference value is hexadecimal form
of hash code, where hash code value is an unique identity provided by heap
manager in the form of an integer value in order to recognized objects
individually.
3.
Pointer
variable must required static memory allocation.
Reference variable must required dynamic memory allocations.
Note:-
Pointer are recognized and initialized at
the time of compilation, but reference variable are recognized and initialized
at run time.
Note :-
Pointer are recognized and initialized at
the time of compilation, but reference variable are recognized and initialized
at run time.
4.
Pointer are supported by static programming
languages,
Reference variable are supported by dynamic
programming language.
5.
Multiple inheritance is
not available in java
The process of getting variables and method
from one class to another class is called as inheritance.
The main objective of inheritance is “code
reusability”.
At basic level of object orientation there
are two types of inheritances
1.
Single inheritance
2.
Multiple inheritances
1.
Single inheritance :-
The process of getting variable method from only one super class to one
or more number of sub Classes is called as single inheritance
2.
Multiple inheritance :-
The process of getting variables and method from more then one super
class to one or more number of sub classes is called as multiple inheritances.
In the above multiple inheritances, if we declare same variable with difference
values and same method with difference implementation at both super classes and
if we access that variable and method in the respective sub class then which
super class variable would be accessed and which super class method would be
accessed is confusion state.
Java is a simple programming language; it should not allow confusion
oriented features, so that multiple inheritances is not allowed in java.
Note :-
In java multiple inheritance is restricted by preparing “extends” keyword
in such a way to allow only one super class name.
Date :12- july-2016
Mr. nagur babu
6.
C++ required destructor feature,
but, java is not destructor feature?
If any programming language allows to store data in the form of object
then that programming language is called object oriented programming language.
In object oriented programming languages, it is minimum conversion to
store the data in the form of object’s in object oriented programming language
, first, we have to create object at staring point of the program then we have
to destroy object at ending point of the program.
In object oriented programming language, to create object, we will use “constructors”
and to destroy object’s, we will use “destructors”.
In java application, to destroy object’s, java has provided on implicit
tool that is
“garbage collector”, so that developers are not required to destroyed
object’s therefore, destructors are not required in java.
In case of c++, garbage collector kind of tool is not available, so that
developers must destroy object explicitly, for this developers must use “destructors”
to destroy object explicitly.
7.
Operating overloading is
not available in java
The process of declaring as operator with more then one functionality is
called as operator overloading
Ex 1:-
Int a=10;
Int b=20;
Int c=a+b; //+ is for arithmetic addition
System.out.println(c); // output: 30
Ex 2:-
String str1= “abc”;
String str2= “def”;
String str3= Str1+Str2; //+for string concatenation
System.out.println(Str3); // output: abcdef
Operation overloading is not possible in java, because
1.
Operator overloading is rarely used features in
application development.
2.
Operator overloading will increase confusion to
the developers, when we declare more number of operator’s with more number of
functionalities.
Note:- As per java internal requirement, java has
defined some of the predefined operators like +, *,% --------as overload
operator with fixed functionalities, but java has not provided any environment to
do operator overloading explicitly at developers level.
8.
C & c++ are allowing
“call by value and call by reference ” parameter passing mechanisms, but java
is allowing only call by value parameter passing mechanism.
In any programming language, if we pass primary data as parameter to the methods
then the parameter passing mechanism is call by value
In any programming language, if we pass address location’s as parameter’s
to the method ‘s then the parameter passing mechanism is call by reference.
In case of c & c++ application, if we pass pointer variables as
parameters to the method’s then the parameter passing mechanism is call by
reference, because, pointer variable are storing address locations.
In case of java, if we pass reference variable’s as parameter to the
method’s then the parameter passing mechanism is call by value only, not call
by reference, because object reference variables are stored object reference values,
which is hexadecimal form of hash code, where hash code is an unique identity provided
by heap manager in the form of integer value in order to recognize objects independently.
Date :13- july-2016
Mr. nagur babu
9.
In c & c++, integers
will take 2 byte of memory and characters will take 1 byte of memory, but in
java integer will take 4 byte of memory and characters will take 2 byte of
memory.
In case of c & c++ memory allocation for the primitive data type is
not fixed, it is variables, it is depending on the operating system which we
used. In case of java, memory allocated for the primitive data types as fixed,
it is not variable, it is not depending on the operating system which we used.
Memory allocation
Byte
|
1
byte of memory
|
Short
|
2
bytes of memory
|
Int
|
4
bytes of memory
|
Long
|
8
bytes of memory
|
Float
|
4
bytes of memory
|
Double
|
8
bytes of memory
|
Char
|
2
bytes of memory
|
Boolean
|
1
bit of memory
|
Q) In c & c++ application, one byte
of memory is sufficient to store character’s data then, what is the requirement for java to assign 2 byte of
memory for character ?
Ans)
In c & c++ application’s, all the characters are represented
in the form of ASCII value, where to store ASCII value one byte of memory is
sufficient.
In case of java, all the characters are represented in the
form of UNICODE value, where in java applications, to store UNICODE value two
bytes of memory is required.
Note :- UNICODE is one of the character representation, it
able to represented all the alphabet from all the natural languages like English,
tamil, hindi, telugu…… etc and it able to provide very good
internationalization support in java application.
Note:- designing java application as per local convention is
called as internationalization.









No comments:
Post a Comment