Home Tutorialhelp Comment Hi! Rama krishna Your queries has been solved.

 
 

Comment

roseindia team
Hi! Rama krishna Your queries has been solved. ,
January 9, 2007 at 1:19 PM

Hi! Rama krishna
Your queries has been solved.

Question: what is the class variables ?
Answer: When we create a number of objects of the same class, then each object will share a common copy of variables. That means that there is only one copy per class, no matter how many objects are created from it. Class variables or static variables are declared with the static keyword in a class, but mind it that it should be declared outside outside a class. These variables are stored in static memory. Class variables are mostly used for constants, variable that never change its initial value. Static variables are always called by the class name. This variable is created when the program starts i.e. it is created before the instance is created of class by using new operator and gets destroyed when the programs stops. The scope of the class variable is same a instance variable. The class variable can be defined anywhere at class level with the keyword static. It initial value is same as instance variable. When the class variable is defined as int then it's initial value is by default zero, when declared boolean its default value is false and null for object references. Class variables are associated with the class, rather than with any object.
Question: What is the difference between the instanceof and getclass, these two are same or not ?
Answer: instanceof is a operator, not a function while getClass is a method of java.lang.Object class. Consider a condition where we use
if(o.getClass().getName().equals("java.lang.Math")){ }
This method only checks if the classname we have passed is equal to java.lang.Math. The class java.lang.Math is loaded by the bootstrap ClassLoader. This class is an abstract class.This class loader is responsible for loading classes. Every Class object contains a reference to the ClassLoader that defines. getClass() method returns the runtime class of an object. It fetches the java instance of the given fully qualified type name. The code we have written is not necessary, because we should not compare getClass.getName(). The reason behind it is that if the two different class loaders load the same class but for the JVM, it will consider both classes as different classes so, we can't compare their names. It can only gives the implementing class but can't compare a interface, but instanceof operator can.
The instanceof operator compares an object to a specified type. We can use it to test if an object is an instance of a class, an instance of a subclass, or an instance of a class that implements a particular interface. We should try to use instanceof operator in place of getClass() method. Remember instanceof opeator and getClass are not same. Try this example, it will help you to better understand the difference between the two.
Interface one{
}

Class Two implements one {
}
Class Three implements one {
}

public class Test {
public static void main(String args[]) {
one test1 = new Two();
one test2 = new Three();
System.out.println(test1 instanceof one); //true
System.out.println(test2 instanceof one); //true
System.out.println(Test.getClass().equals(test2.getClass())); //false
}
}

View All Comments | View Tutorial
Advertisement
Related Tutorial and Articles
JSP Servlet Questions

Not Yet Solved - JSP-Servlet
Not Yet Solved  Hi Rose, Thanks alot, but the code is not working at all, it even stopped me from accessing the database, please kindly solve... first insert the details in the database for the first time you open your browser 

iPhone

Protecting Your iPad Has Never Been Easier
Protecting Your iPad Has Never Been Easier Since its release early in 2010, the iPad has been flying off the shelves in stores all over the world... of accessories for the iPad, each of which has been designed to ensure you get the most out 

PHP Questions

Call-time pass-by-reference has been removed in
Call-time pass-by-reference has been removed in  HI, What is the solution for the error: Call-time pass-by-reference has been removed in Thanks 

JSP Servlet Questions

Tomcat Error: coyote connector has not been started
Tomcat Error: coyote connector has not been started  Hi, I am not able to start the tomcat server. If I try to start it then I am getting the below error. "coyote connector has not been started" Could some body please help me 

Spring Framework Questions

the JDBC Driver has been forcibly unregistered
the JDBC Driver has been forcibly unregistered  Hi my application... application was st opped. To prevent a memory leak, the JDBC Driver has been... the web application was stopped. To prevent a memory leak, the JDBC Driver has been 

Framework Questions

getOutputStream() has already been called for this response
getOutputStream() has already been called for this response  hi to all, i am trying to export some data from my project to excel file....while... exception: java.lang.IllegalStateException: getOutputStream() has already been 

Java Beginners

corejava - Java Beginners
("The data has been written"); } else 

Java Beginners

corejava - Java Beginners
What is Dynamic Binding  What is Dynamic Binding in Core Java?  Hi,Dynamic Binding:It is the way that provide the maximum functionality...://www.roseindia.net/java/master-java/java-object-oriented-language.shtmland then post your 

Java Beginners

Not Yet Solved - Java Beginners
Not Yet Solved  Hi, Hi Rose, The application is a Standard edition related not Servlet, and more so please use Microsoft SQL to solve all my problems. i use Microsoft Database and not MySQL. I Develope a School 

Java Interview Questions

corejava - Java Interview Questions
corejava  how to validate the date field in Java Script?  Hi friend, date validation in javascript var dtCh= "/"; var minYear...; } return returnString; } function daysInFebruary (year){ // February has 29 

Java Beginners

Find the date of the file before the file has been modified
Find the date of the file before the file has been modified  Hi, may i know is it possible to find the date of the file before the file has been modified?   hi friend, you can get the date of last modified file using 

Java Beginners

Find the files that has been modified before run the program
Find the files that has been modified before run the program  Hi. I... in the directory and run the program, it can list out the file that i has been... is: How can i list out all the files that has been modified before i run 

Java Beginners

Find the files that has been modified before run the program
Find the files that has been modified before run the program  Hi. I... that i has been modified. But when i modified more then 1 files in the directory.... My question is: How can i list out all the files that has been modified before 

Java Beginners

Find the files that has been modified before run the program
Find the files that has been modified before run the program  Hi. I... in the directory and run the program, it can list out the file that i has been... is: How can i list out all the files that has been modified before i run 

Java Beginners

CoreJava Project
CoreJava Project  Hi Sir, I need a simple project(using core Java, Swings, JDBC) on core Java... If you have please send to my account 

JSP Servlet Questions

Exception: java.lang.IllegalStateException: getWriter() has already been called for this response - JSP-Servlet
Exception: java.lang.IllegalStateException: getWriter() has already been called for this response    response.setContentType("text/html;charset... String and image in the same html page. Please help me  Hi friend 

Development process Questions

jmeter queries - Development process
jmeter queries  I'm Hema, new to JMeter tool. I've been told to learn this tool and perform Functional and Performance Testing for our current... Username and Password 3) How Graph has to be analysed? 4) How to alter the source 

Programming Tutorials

Corejava Interview,Corejava questions,Corejava Interview Questions,Corejava
to limit file selection. You could write your own custom filter that only takes 

Programming Tutorials

Corejava Interview,Corejava questions,Corejava Interview Questions,Corejava
variable for your class name.      Q 11 :  What 

Struts Questions

hi... - Struts
also its very urgent  Hi Soniya, I am sending you a link. I hope that, your problem will be solved. Please visit for more information...hi...  Hi Friends, I am installed tomcat5.5 and open 

Mobile Applications Questions

Resources have been modified iPhone
Resources have been modified iPhone  Hi, My client is getting Resources have been modified error while installing AdHoc distribution on his iPhone. How to solve Resources have been modified iPhone error? Thanks   Hi 

Java Beginners

Hi
Hi  I want import txt fayl java.please say me...   Hi, Please clarify your problem! Thanks 

Java Beginners

Hi..
Hi..  what are the steps mandatory to develop a simple java program?   To develop a Java program following steps must be followed by a Java... in your system and its path must be located in the Environment variable. For detail 

JavaScript Questions

hi
makes a menu selection he or she has already made, ignore the selection 

Java Beginners

hi.......
hi.......  import java.awt.; import java.sql.*; import javax.swing....+"'"); JOptionPane.showMessageDialog(null,"Your savings is: "+ts); } } catch(Exception e...(null," You have withdrawn "+withdrawl+" shillings and your balance 

JDBC Questions

HI!!!!!!!!!!!!!!!!!!!!!
HI!!!!!!!!!!!!!!!!!!!!!  import java.awt.*; import java.sql....+"'"); JOptionPane.showMessageDialog(null,"Your savings is: "+ts... withdrawn "+withdrawl+" shillings and your balance is "+leftSavings 

Development process Questions

hi
hi   i want to develop a online bit by bit examination process as part of my project in this i am stuck at how to store multiple choice questions...])){ count++; } } out.println("Your "+count+" answers are correct"); %> For more 

Java Beginners

corejava - Java Beginners
corejava pass by value semantics  Example of pass by value semantics in Core Java.  Hi friend,Java passes parameters to methods using pass by value semantics. That is, a copy of the value of each of the specified 

Blog

JBoss Tools 3 Alpha has been released
The first Alpha release of JBoss Tools 3 has been made recently with intials..., Portal etc. All plugins in the new release have been now shifted to Eclipse... in the Eclipse API. The new features that have been added to this Release are as follows 

XML Questions

hi - XML
for displaying breaking news. use RSS javascript Library in your application Thanks Rajanikant  Hi friend, It is a format to share data.... 4. Another website that wants to display the feed. It has to load the RSS 

Hibernate Questions

Hibernate named queries
Hibernate named queries  Hi, What is named queries in Hibernate? Thanks 

Java Interview Questions

corejava - Java Interview Questions
Core Java vs Advance Java  Hi, I am new to Java programming and confuse around core and advance java 

Java Beginners

corejava - Java Beginners
Deadlock Core Java  What is Deadlock in Core Java?   Deadlock is nothing but accessing a same space by different by different programs at the same time . To avoid this problem java has a concept called synchronization 

Java Interview Questions

corejava - Java Interview Questions
corejava  how to merge the arrays of sorting i want source code of this one plz---------------------------------------------  Hi Friend, Try the following code: public class MergeSort{ public static void main 

Java Interview Questions

Corejava - Java Interview Questions
having only numeric values by using Pattern class.   Hi Friend, 4 

Java Beginners

corejava - Java Beginners
Tutorials for Core Java beginners  Can anyone share their example of Encapsulation in java? I'm a core Java beginner.  Hi,Here is the description of Encapsulation in java:Encapsulation is a process of binding 

Java Beginners

corejava - Java Beginners
corejava  hai this is jagadhish. I have a doubt on corejava.How many design patterns are there in core java? which are useful in threads?what r the names of these design patterns? ok thank you (inadvance).  Hi 

Java Beginners

corejava - Java Beginners
corejava  code for converting the numer into character(for ex;if we enter 1 it will comes in words like one)?  Hi friend, import java.io.*; class NumToWords { private static final String[] maxWords 

Java Beginners

corejava
 

Java Interview Questions

corejava
 

Java Beginners

CoreJava
 

JDBC Questions

Need help with nested queries
Need help with nested queries  Hello, Table1 has "id", "votes" columns. Table2 has "id", "Name" column. I need to retrieve Name and its corresponging Votes. I tried with nested queries but its confusing. Can anyone please help 

Java Technology Tutorials

JPA Native Queries, JPA Native Queries Tutorials
JPA Native Queries       In this section, you will know about the jpa native queries and how to use native query in your JPA application.  JPA Native Queries: JPA native 

EJB Questions

ejb3.0 join queries - EJB
ejb3.0 join queries   Hi Guys, I am new to ejb3.0 . As i am new to ejb3.0 i am unable to write join quries.i am having 3 tables...;Hi friend, table Articles; table Authors; table AuthorArticle 

Hibernate Questions

Hibernate Criteria Queries - Hibernate
= session.createCriteria(TreasuryClient.class);   Hi friend, package 

Java Interview Questions

queries
 

Java Beginners

queries
 

Mobile Applications Questions

The app was not installed on iphone because its resources have been modified
resources have been modified" What is the solution? Thanks   Hi, You have...The app was not installed on iphone because its resources have been modified  Hi, I am getting following error while my client is installing my 

HTML Questions

How to find if you have been hit by Panda 4.0
How to find if you have been hit by Panda 4.0  Hi, This week Google Panda 4.0 is released. Now the question is how to find if your website have been... if your website have been hit by the Panda 4.0. Here are thinks you can do 

Programming Tutorials

How to promote your writing through your website
interviewed. Remember that online promotion has been a reciprocal business... How to promote your writing through your website  ... to promoting your latest book? Tired of the endless running around after 

Hibernate-Tutorials

Hibernate Polymorphic Queries
Hibernate Polymorphic Queries In this tutorial you will learn about the HQL polymorphic queries. Hibernate supports the polymorphic queries. Polymorphic means the polymorphism i.e an object that has a IS-A relation with their own type 

Design concepts & design patterns Questions

How to design a tomato patch on your car
How to design a tomato patch on your car This tutorial will help you to insert a tomato patch on the bonnet of the car, this effect has been made by this example so follow now. Take Picture: Capture any 

SQL Question

hi - SQL
hi  hi sir,i want to copy the sql prompt queries to one text file,how to achieve this ,plz tell me Thanq 

SQL Question

hi - SQL
hi  hi sir,i want to copy the mysql prompt queries to one text file,how to achieve this ,plz tell me Thanq 

Web Development

Google Ranking Update for Spammy Queries
ranking update today for some spammy queries". This update was worldwide and many... in their ranking and disappeared from search results. This update targets spam queries like payday loan, pornographic and mobile websites. It has impacted 0.3 to 0.5 

Java Technology Tutorials

JPA Sub-Queries
JPA Sub-Queries       In this section, you will see how to use sub-queries in your JPA application. Sub-queries allows you for querying the vast number of data 

SQL Question

update database using two queries at a time
update database using two queries at a time  String sql="insert... can execute two queries with two different Statement object in the following way. Another thing, you have executed same query twice in your code. Statement st1 

WebSevices Questions

hi RoseIndia why there is not Fackbook Like button on your webpage?
hi RoseIndia why there is not Fackbook Like button on your webpage?   hi RoseIndia why there is no Fackbook Like button on your webpage? That's the only prob in your problem. Others are excellent 

JavaMail Questions

hi - JavaMail
hi  Hi, I am using hibernate inorder to retrieve data from two tables and I mapped two tables has a relationship of one2many But actually how to retrieve the data from tables in Java class and get me the code how 

Ajax Questions

hi - Ajax
hi  hi, i am doing Web surfing project. i used start and end... hour result. waiting for yours reply..  Hi vinoth Here is the some project where u may found the solution about your problem http 

Programming Tutorials

Get an Editor to polish your pages
Get an Editor to polish your pages   ... will improve the credibility of your site as bad language makes the users lose confidence in the material that they will find on your site. Editors can also make 

Java Beginners

hi all - Java Beginners
hi all  hi, i need interview questions of the java asap can u please sendme to my mail   Hi, Hope you didnt have this eBook. You.../Good_java_j2ee_interview_questions.html?s=1 Regards, Prasanth  HI 

Software Services

Portal Development ' A Step Towards The Success Of Your Business
at the amount of business online today. Your website has got to be up to date and snazzy... choose a company that has been around for a number of years and that has a good...Portal Development – A Step Towards The Success Of Your Business Web 

Java Beginners

variable answer1 might not have been initialized
variable answer1 might not have been initialized   import java .io... ctr1=0; System.out.println("Enter your name:"); name..."); System.out.println("\tD. None of these"); System.out.print("Enter your answer 

Technology

Ways to Elevate Your Fleet Business
is traveling, how many times the break has been used, places of the halts that were... in storing the data related to work that has been finished, that has to be assigned...There are several ways to elevate your fleet business. Owners and mangers just 

JDBC Questions

MySQL server has gone away
MySQL server has gone away  Hi, What is the reason of error "MySQL server has gone away"? Some time in my application this error is coming. Thanks   hi friend, This happens because the server is timed out 

iPhone

Apple's Ipad? How It Can Enhance Your Social Networking Experience?
to stores to get their hands on their very own iPad. The device has been... of the one fitted to the iPhone, and with its increase in size there has also been... aspect of the iPad that has been highlighted is the fact that it doesn’t 

Programming Tutorials

Corejava Interview,Corejava questions,Corejava Interview Questions,Corejava
 

Programming Tutorials

Corejava Interview,Corejava questions,Corejava Interview Questions,Corejava
 

Software Services

Ecommerce Web Development Helping You Get The Best Out Of Your Online Business
Ecommerce Web Development – Helping You Get The Best Out Of Your Online Business The online marketplace has grown in leaps and bounds and with so... have to take extra steps to ensure your business not only runs better 

Java Beginners

I need your help - Java Beginners
I need your help  For this one I need to create delivery class... represent the area. E.g, the 76th delivery in 2010 has a complete delivery number... the file name is ApplicationDelivery.java Your program must follow proper Java 

Log4J Questions

some queries pertaining to use of log4j for logging in a java application-
some queries pertaining to use of log4j for logging in a java application-  Please clarify the following for me- (1) I want to use a rollingfile... that as well. (4) The application in which I want to use log4j has multiple 

Java Beginners

Hi Check this.... - Java Beginners
Hi Check this....  Hi Sakthi here.. Run This Code..   Hi sakthi Your code is not visible here, can u send again please.. Thanks 

Software Services

Oscommerce Injecting Style Into Your Business
of business practice has been made possible because of the various advancements...Oscommerce – Injecting Style Into Your Business More and more people... with taking your business online. You get a greater amount of advertising and you 

General Information

25 Ways To Make Money In Your Spare Time
accounts, which have been inoperative, and it can return cash, which has become...; the only way is to enhance your income sources. Business experts also say... to earn extra money and hence these 25 ways to make money in your spare time could 

JSP Servlet Questions

HI Jsp check box..!
HI Jsp check box..!  Hi all.. I want to update the multiple values of database table using checkbox..after clicking submit the edited field has to update and rest has to enable to update...please help me..its urgent 

Ajax Examples

Your Bubblez
Your Bubblez       Your... your desktop windows but within your browser on a single DHTML page. You can draw... you visit us we?ll keep your last setup for you just as you left it. We are a new 

Java Beginners

Hi.. - Java Beginners
Hi..  Hi, I got some error please let me know what is the error integrity constraint (HPCLUSER.FAFORM24GJ2_FK) violated - parent key its very urgent  Hi Ragini can u please send your complete source 

Java Beginners

Hi - Java Beginners
Hi  Hi friends, I want download c&c++ software.....can u send me link....its urgent...please send me likn or site name  Hi Friend Pradip Dutta Go this link http://www.bloodshed.net/ Here you can fine your 

Java Beginners

Hi... - Java Beginners
but this not working Upload Record please tell me   Hi Friend, Please clarify your question. Thanks  Hi frnd, Your asking...Hi...  Hi friends, I hv two jsp page one is aa.jsp & bb.jsp 

Java Beginners

Hi... - Java Beginners
Hi...  Hi, I want make a date fields means user click date... code; if any one need just mail me: fightclub_ceo@sify.com   Hi friend, As your requirement to solve the problem to visit... http 

Java Beginners

hi.... - Java Beginners
hi....  Hi friends i am using ur sending code but problem... very urgent   Hi ragini, First time put the hard code after that check the insert query. Because your code very large. If hart code 

Java Beginners

hi roseindia - Java Beginners
hi roseindia  what is java?  Java is a platform independent... as similar to C++. But JAVA has additional feature of Database connectivity, Applets...). Thanks/Regards, R.Ragavendran...  Hi deepthi, Read for more 

Development process Questions

hi - Development process
hi  hi sir. i was used one openbiblio site it has all projects screens shots only it is very useful to me for developing my projects.now that site won't work. could u tell like this site are available? pls tell i need projects 

Java Beginners

hi - Java Beginners
,then there is no way to change this,plz tell me for my problem  Hi Friend, Declare... then, if you got any error then post your code. Thanks 

Java Beginners

hi, - Java Beginners
hi,  what is the need for going to java.how java differ form .net.What is the advantage over .net.Is there any disadvantage in java  Hi...,like Visual Basic, C# etc. 4).Net has more integrated development environment 

Java Beginners

hi - Java Beginners
hi  Hi.... let me know the difference between object and instance variables with examples....  Hi friend, Objects are key.... An instance method has access to all the instance variables, other instance 

Java Beginners

Hi,
Hi,  Hi,what is the purpose of hash table 

Interview Questions

What would you rate as your greatest weaknesses?
. Unless you are prepared, chances are that you will undo all the good that has been... What would you rate as your greatest weaknesses... for your honesty, but your resume will end up in the dustbin after the interview 

Java Beginners

Hi, - Java Beginners
Hi,  Hi Friends, I want to write code in java for change...,con_pwd Thanks  Hi Friend, Create a database table login[id...='"+value2+"' where id='"+id+"'"); JOptionPane.showMessageDialog(null,"Your password 

Job Tips

Improve Your Assertiveness at Work
. This belief has been reinforced by terms such as ‘aggressive market strategy&rsquo... of research has been gone into the psychology of assertive behaviour... Improve Your Assertiveness at Work    

Java Beginners

Hi ...CHECK - Java Beginners
Hi ...CHECK  Hi Da..sakthi Here RUN THIS CODE ----- package... JLabel("SELECT YOUR CHOICE FROM THE LIST BELOW"); p1.add(lb1);p1.add(lb2... "); Screen.showMessage(" DON WORRY WE'ILL ROCK "); } } }   Hi 

Java Beginners

Hi,
Hi,   labels = new Hashtable<Integer,JLabel> 

Java Beginners

Hi..
Hi..   what are the keywords available in simple HelloWorld program 

Java Beginners

Hi..
Hi..  what are access specifier available in java 

Ajax Questions

HI.
HI.  hi,plz send me the code for me using search button bind the data from data base in dropdownlist 

Java Beginners

Hi..
Hi..  null is a keyword.True/False?   hi friend, In Java true, false and null are not a Java keyword they are literals in Java. For reading in detail go through the following link The null keyword 

Java Beginners

hi,
hi,  print("code sample");how to display all elements in 2d array usin any one loop 

Struts Questions

Hi
Hi  Hi this is really good example to beginners who is learning struts2.0 thanks 

Java Interview Questions

Hi
Hi  Hi How to implement I18N concept in struts 1.3? Please reply to me 

Advertisements Advertisements
 

 

 

DMCA.com