My answer to Naresh Kumar Query is Java is 100% object oriented because Java supports od the features of OOAD (Object Oriented Analysis and Design). For primitive datatyes java has provided immutable wrapper classes to convert to objects. Moreover, any thing and everything in java is written inside a class.
Now try to correlate with procedural languages..
cool
Shambhu
Java implements inhertance using keywords “extends” and “implements”. “extends” for classes and “implements” for interfaces. Remember java does support multiple inheritance. So a class can only extends one class and implement many interfaces.
Where as anonymous inner classes use the keyword “new” to extends a class or to implement an interface.
In general Java doesn’t support operator overloading. But the developers of Java has given some flexiblity.
ie we get the benefits of operator overloading in java.
Here the “+” operator dealing with different datatypes. Here we can say “+” operator is overloaded.
In the last example, due to arithmetic promotion of operands, variable “b” of type byte is promoted to the type double. That’s why we get “2.0″ as result.
But according to rules of Java, Java doesn’t support operator overloading. :)
1.What is the Purpose of the XML…?
2.And wht about the features of it….?
3.What is parsing in XML…?
Plz give some examples……
Plz give me the reply as early as possible? It’s urgent
Hi,
I have read comments about why Multiple Inheritance is not part of Java, let me remind that actually MI is a concept devised in Object Oriented Analysis and Design and not with C++. C++ has only implemented OOAD principles. Infact you may take any other OO language like PERL (not scripting lang) or python, you can implement the same.
Java chose not to implement due to confusion during usage. Nothing beyond it.
how to draw a program flowchart based on the following scenario:
The program will prompt the user to enter his/her name and age and determine whether he/she is an adult or teenager. If he/she is below 21 years old, the user would be a teenager else he/she would be an adult. The user would be prompted after each person, if he/she wishes to enter another name. The program continues to run until the user enters “No†or “Nâ€Â.
static var: it holds the memory for once which is shared by all
objects.
static () :it allows to use static variables or class variables only
it doesn’t allows 2 use instance variables or fields.
static{}: it is a static block& will b executed for exactly for
once in a class.these r executed at first in the class
before anything.
* it allows only static data
* a class can contain any number of static blocks.
difference between c++ and java is c++ is not pure object oriented programing language(oopl),but java is pure oopl.
some basical differences are
* c++ have pointers ,but java does not contain pointers
*c++ supports multiple inhertaince,java cant support multiple inhertiance
* to over come the problem of multiuple inhertaince,java introduce interfaces
*c++ features are dynamic bynding, message passing,polymorphism,inheritance,templates
*java features are threads,applets,servlets ,packkeges,awt tools
What gives java it’s “write once and run anywhere†nature?
java is platform independent ,it can be run in any where ,ie,it can be run in any operating system.thats why java is very famous in now technologies
Does Java have “goto�
java does not support goto statement ,because goto sttement conatain lable up:, controller directly transfer to the up statement,it may face difficult in java
What is the meaning of “final†keyword?
final is keyword in java ,it can be work as like as constructor .when object is invioked all methods at finally without invoke of this final ,it will automatically will executed.it can be mainly used for printing of some message at finaally
67 Comments on Simple Java questions
My answer to Naresh Kumar Query is Java is 100% object oriented because Java supports od the features of OOAD (Object Oriented Analysis and Design). For primitive datatyes java has provided immutable wrapper classes to convert to objects. Moreover, any thing and everything in java is written inside a class.
Now try to correlate with procedural languages..
cool
Shambhu
To Vinay’s Query
Java implements inhertance using keywords “extends” and “implements”. “extends” for classes and “implements” for interfaces. Remember java does support multiple inheritance. So a class can only extends one class and implement many interfaces.
Where as anonymous inner classes use the keyword “new” to extends a class or to implement an interface.
Cool,
Shambhu
To Venkat’s Query
In general Java doesn’t support operator overloading. But the developers of Java has given some flexiblity.
ie we get the benefits of operator overloading in java.
for eg:
byte b = 1;
double d = 1.0′
System.out.println(”1″ + 1); // 11
System.out.println(1 + 1); // 2
System.out.println(b + d); // 2.0
Here the “+” operator dealing with different datatypes. Here we can say “+” operator is overloaded.
In the last example, due to arithmetic promotion of operands, variable “b” of type byte is promoted to the type double. That’s why we get “2.0″ as result.
But according to rules of Java, Java doesn’t support operator overloading. :)
Cool,
Shambhu
1.What is the Purpose of the XML…?
2.And wht about the features of it….?
3.What is parsing in XML…?
Plz give some examples……
Plz give me the reply as early as possible? It’s urgent
why java is not pure oop language?
the reason are 1.primitive datatype
2.not supporting entire inheritance
concept
Hi,
I have read comments about why Multiple Inheritance is not part of Java, let me remind that actually MI is a concept devised in Object Oriented Analysis and Design and not with C++. C++ has only implemented OOAD principles. Infact you may take any other OO language like PERL (not scripting lang) or python, you can implement the same.
Java chose not to implement due to confusion during usage. Nothing beyond it.
how to draw a program flowchart based on the following scenario:
The program will prompt the user to enter his/her name and age and determine whether he/she is an adult or teenager. If he/she is below 21 years old, the user would be a teenager else he/she would be an adult. The user would be prompted after each person, if he/she wishes to enter another name. The program continues to run until the user enters “No†or “Nâ€Â.
Give me answer hurry.
to sreekant’s
static var: it holds the memory for once which is shared by all
objects.
static () :it allows to use static variables or class variables only
it doesn’t allows 2 use instance variables or fields.
static{}: it is a static block& will b executed for exactly for
once in a class.these r executed at first in the class
before anything.
* it allows only static data
* a class can contain any number of static blocks.
Class A
{
int a;
a=10;
}
when compile this code leads to error. Can some one explain why?
How “typedef” functionality can be achived in Java.
Hi,
Hari.Dasani, you are initializing outside of a subroutine in two lines, that usually raises an error. Try
class A
{
int a = 10;
}
Usually you instantiate the variables in the constructor.
Thanks
Hope that helps
abstract class means ,use same class name to another classes will helpful abstract classes
difference between c++ and java is c++ is not pure object oriented programing language(oopl),but java is pure oopl.
some basical differences are
* c++ have pointers ,but java does not contain pointers
*c++ supports multiple inhertaince,java cant support multiple inhertiance
* to over come the problem of multiuple inhertaince,java introduce interfaces
*c++ features are dynamic bynding, message passing,polymorphism,inheritance,templates
*java features are threads,applets,servlets ,packkeges,awt tools
What gives java it’s “write once and run anywhere†nature?
java is platform independent ,it can be run in any where ,ie,it can be run in any operating system.thats why java is very famous in now technologies
Does Java have “goto�
java does not support goto statement ,because goto sttement conatain lable up:, controller directly transfer to the up statement,it may face difficult in java
What is the meaning of “final†keyword?
final is keyword in java ,it can be work as like as constructor .when object is invioked all methods at finally without invoke of this final ,it will automatically will executed.it can be mainly used for printing of some message at finaally