Home Answers Viewqa Java-Interview-Questions java question related to objects

 
 


sajna cs
java question related to objects
1 Answer(s)      2 years and 2 months ago
Posted in : Java Interview Questions

what is the output of the following code?

public class objComp { Public static void main(String args[]) { Int result = 0; objComp oc= new objComp(); object o = oc; if( o==oc) result =1; if(o!=oc) result = result+10; if (o.equals(oc)) result=result+100; if (oc.equals(o)) result=result+1000; system.out.println(result); } }

View Answers

March 16, 2011 at 12:05 PM


There were so many errors. After removing all those error, we get the output: 1101

public class objComp {
    public static void main(String args[]) {
        int result = 0; 
        objComp oc= new objComp(); 
        Object o = oc; 
        if( o==oc)
        result =1; 
        if(o!=oc)
        result = result+10;
        if (o.equals(oc))
        result=result+100;
        if (oc.equals(o))
        result=result+1000;
        System.out.println(result);
        }
        }









Related Pages:
java question related to objects
java question related to objects  what is the output of the following code? public class objComp { Public static void main(String args[]) { Int result = 0; objComp oc= new objComp(); object o = oc; if( o==oc) result =1; if(o
Java and jvm related question
Java and jvm related question  What is difference between java data types and jvm data types
Java Related Question
Java Related Question  hi, Why java doesn't has primitive type as an object,whats an eligibility to have a primitive type as an object by the languages
java related question
java related question  How can we make a program in which we make mcqs question file and then make its corresponding answer sheet....like if we make 15 mcqs then java should generate it answer sheet of 15 mcqs with a,b,c d
Java Related Question
Java synchronized method  Dear Friend, I have written below program for synchronized method in java but it's not working plz help me. program...","mangal","to","java"}; String name; SynchronizedModel(String nam) { name
Java Related Question
Java synchronized method  Hi, I have written below program for synchronized method in java but it is not working please help me. program...","to","java"}; String name; SynchronizedModel(String nam
Objects
to explain, how to represent objects in Java using classes, methods... Objects       Objects In this section we are going to illustrate how the real life objects are the key
java fundamental question related to string
java fundamental question related to string  public class Myclass { Public static void main(String args[]) { String s=â??helloâ??; StringBuffer sb=new StringBuffer(s); Sb.reverse(); If(s==sb) system.out.println(â??aâ
Java Objects - Java Beginners
Java Objects  Hi I have the following question, What method in Java is used to destroy your objects. Thanks in advance
Classes and Objects
at run time. Objects: An object is the combination of related... Classes and Objects       Objects... the main() method.  A class can have more than one instances (objects), let us
Objects - Java Beginners
Objects  Hello, assist me crack this programming question. Develop a class to represents a human. The head, arms and legs should be properties of the human and should be represented by separate objects. All of your objects
Question related to Hibernate
Question related to Hibernate  Why do we use Set in child class in 1:many hibernate ,why can't we use Directly HashSet
Avanced objects - Java Beginners
Avanced objects  Hello sir, i sent in this question for assistance in coding, i had however left out part of the question as seen in part b). of the question. I still request for your help with both questions. a) Develop
Related to multiple inhetitance - Java Beginners
Related to multiple inhetitance  Sir, Plz help me to solve this question. Q.1. Write a Progarm to illustrate the concept of multiple inheritance using interface
Objects - Java Beginners
Objects  Hello, assist me crack this programming question. Develop... of the human and should be represented by separate objects. All of your objects...) { //Declare and create a Headmain object //and Three ArmsMain objects
Struts related Question
Struts related Question  Hi All, I have a one question on validation framework for client side validation please help me on that. suppose i don't want to put required=true in our JSP then what will happen. what error will come
project related question
project related question  1- how to insert a date through hibernate 2- how to insert exact time ,date separetly in the data base for current time date
string related question
string related question  *q.1>how i dispaly the reference of string variableS ? eg:-String s1="my name"; Sring s2="your name"; here what is address of variable s1 and s2
Data base related question
Data base related question  sir my table has only one element(that is pno),i am using ms-access as backend. i put only one element i want to retrieve that element .how can i retrieve that element,using jdbc technology. please
Core Java Interview Question, Interview Question
Core Java Interview Question Page 23  ... and interfaces that are loaded by a Java program. Question: How does a try statement... which causes it to become accessible to reachable objects. Question: When
Serializing Objects Into Database - java tutorials
Serializing Objects Into Database 2001-05-24 The Java Specialists' Newsletter [Issue 020] - Serializing Objects Into Database Author: Dr. Heinz M... at the SQLException. Back to the problem of writing serialized Java objects
Java Objects
Java Objects  What are Data Transfer Objects and where are they used
related to java
related to java  what is mean of }); in java.i know that } is used to close a block of statement,) is used to close a statement and ";"is used after close a statement but i can not usderstood the use of }); together in a java
Core Java Interview Question, Interview Question
Core Java Interview Question Page 31       Threads Question: Where does java thread... in this way is said to be blocked. Question: What threading related methods
Restlet Frame work Related question
Restlet Frame work Related question  How to send data from client to server using Restlet framework. The main problem is i am not able to get data at server side. Can anyone post a complete program how to achieve
Implicit Objects In JSP
application purpose. A Java developer can use these objects directly... are called the Java objects that implements the Servlet and JSP API's interfaces...Implicit Objects In JSP In this section we will read about the implicit
java question
java question  Hello sir/mam, In collection there is method called toArray() which is used to convert collection into array at tat time array is used 2 store diffferent objects,how is it possible can you describe it briefly
java question
java question  Hello sir/mam, In collection there is method called toArray() which is used to convert collection into array at tat time array is used 2 store diffferent objects,how is it possible can you describe it briefly
java question
java question  Hello sir/mam, In collection there is method called toArray() which is used to convert collection into array at tat time array is used 2 store diffferent objects,how is it possible can you describe it briefly
java question
java question  Hello sir/mam, In collection there is method called toArray() which is used to convert collection into array at tat time array is used 2 store diffferent objects,how is it possible can you describe it briefly
objects create at run time - Java Interview Questions
objects create at run time  how to create objects at runtime,other than instantiation.  Hi friend, Object : Objects are the basic run... is a software bundle of variables and related methods of the special class
Java objects
Java objects  What are the other ways to create an object other than creating as new object
java question
java question  comparator and comparable   Differences... a comparator object is capable of comparing two different objects. b...: http://www.roseindia.net/help/java/c/comparable-interface.shtml http
Classes and Objects
Classes and Objects       Objects and classes are the fundamental parts of object-orientated programming... (objects), let us consider a class employee having the employee details
java question
java question  what r the Comparator vs Comparable   ... object while a comparator object is capable of comparing two different objects. b... the following links: http://www.roseindia.net/help/java/c/comparable-interface.shtml http
Related to Project
Related to Project  how speech to text project can be make in java? Please tell me the coding part therapeutically i know i have to use java speech api which offer two technology 1. speech recognization 2. speech syenthesis
string related
string related  As with any other object, you can create String objects by using the new keyword and a constructor. The String class has thirteen constructors that allow you to provide the initial value of the string using
my question is related to my project viz
my question is related to my project viz   Sir, my project is based on MR tracking system developed using struts framework, it has been developed in Net Beans the whole project is working except a jsp page named dayplan.jsp
Java Data Objects
JDO - Java Data Objects   ... and benefits of JDO specification. The Java Data Objects or JDO for short is Java's... Java model abstraction of persistence, developed as Java Specification Request
question
question   sir plz tell me what should i give in title box. just i want java program for the question typed in this area
question
question   sir plz tell me what should i give in title box. just i want java program for the question typed in this area
Question
Question   When there is an exception in my program how java runtime system handles
question
question  dear sir/madam my question is how to compare two text format in java..we are java beginners..so we need the complete source code for above mentioned question...we have to compare each and every word
java related - Java Beginners
java related  Hello sir, I want to learn java. But I don't know where to start from. I have purchased one java related book. But I am..., shruthi  Hi friend, Java
Java Interview Questions - Page 11
supports the reading of objects from input streams. Question: ... interface provides support for ordered collections of objects. Question... own scrolling. Question: What is a Java package and how is it used
Objects in Java
Objects in Java Whatever we can see in this world all the things are a object. And all the objects are categorized in a special group. That group is termed as a class. All the objects are direct interacted with its class that mean
question
question  how to capture web snippets using java or java script
question
question  why java is platform independent in nature
Question in Array Implementation (java) ??!
Question in Array Implementation (java) ??!  Good Morning EveryOne I have Q in Java - and if any One have the Answers please tall me ??!! Question... stores list of â??PhoneEntryâ?? objects. Use an array of size (MAXSIZE = 1000
question
question  how to solve the problem of The requested resource is not available+java+eclipse

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.