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!=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 Tutorials/Questions & Answers:
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 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
Advertisements
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 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
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â
question related to overloading
question related to overloading  what is difference between function overloading & method overloading
question related to overloading
question related to overloading  what is difference between function overloading & method overloading
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
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
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
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
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
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
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
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
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
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 related - Java Beginners
java related  Why the "public static void main(Strings args... is necessary for a java class to execute it as a command line application... object. void- It specifies the return type. main- This method in java
java related - Java Beginners
java related  is it possible for a biggener to learn a computer language like java to learn it online ?? actually i m a computer science student(fresher) and even in 12th class i have not taken c++ and no knowledge of it ....now
coding related - Java Beginners
/java/java-conversion
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
Core Java Interview Question, Interview Question
Core Java Interview Question Page 23  ... group. ADS_TO_REPLACE_3 Question: What is a Java package and how is it used... that are loaded by a Java program. ADS_TO_REPLACE_5 Question: How does a try statement
Question in Java ??
Question in Java ??   Welcome every One ,I have Q in Java : Write aprogram that print the falewing table using SQRT method in the Math Class? Number squrfoot
Question in Java ??
Question in Java ??  Welcome every One ,I have Q in Java : Write aprogram that print the falewing table using SQRT method in the Math Class? Number 0 ,2, . . . ,18,20 squrfoot 00000 1.4142 5.2426 5.4721
Question in Java ??
Question in Java ??  Welcome every One ,I have Q in Java : Write aprogram that print the falewing table using SQRT method in the Math Class? Number 0 ,2, . . . ,18,20 squrfoot 00000 1.4142 5.2426 5.4721
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
Java Objects
Java Objects  What are Data Transfer Objects and where are they used
Question on java
Question on java  why java is not purely oop?   java is not purely OOP because 1.) Multiple Inheritance is not supported.ADS_TO_REPLACE_1 2.) It uses primitive data type. 3.) static method can be called without
Question Java>?
Question Java>?  **ïâ??· Create a new class called Bank and in the main method use class Account (lab 4) to create an array of 10 accounts. ïâ??· Enter data for all accounts (account number,name, balance). ïâ??· Add
java question
java question   Create a class called Complex to perform arithmetic operations with complex numbers. 1- Use double variables to represent the fields of the class. 2- Provide a no-argument constructor with default values in case
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
Frame related query - Java Beginners
Frame related query  hi..... i m having a query dat...can i open a frame inside another frame like dis.. m a new biginner of java n m finding it very intresting. my lines of codes are like dis:- import java.awt.*; import
java question :)
java question :)  write java program to use vector in ArrayList with add, remove,sort   import java.util.Vector; public class... Element MUAYAD"); vc.add("Vector Element JAVA"); vc.add("Vector Element
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
Core Java Interview Question, Interview Question
collections of objects. Question: How does Java handle integer overflows... Core Java Interview Question Page 12  ... a growable array of objects Question: What modifiers may be used with an inner
Core java interview question, object creation.
Core java interview question, object creation.  How can we restrict to create objects for more than five? That means i want only 5 objects, how to restrict to create 6th objects
Core Java Interview Question, Interview Question
Core Java Interview Question Page 31       Threads Question: Where does java thread... The java language and virtual machine Question: What is the difference
Core Java Interview Question, Interview Question
Core Java Interview Question Page 20       Question: Name four Container classes. Answer..._TO_REPLACE_1 Question: What is the difference between a Choice and a List? Answer
Core Java Interview Question, Interview Question
Core Java Interview Question Page 16  ..._TO_REPLACE_3 Question: How are Java source code files named? Answer: A Java source code... the .java extension. ADS_TO_REPLACE_4 Question: What is the relationship between
Core Java Interview Question, Interview Question
Core Java Interview Question Page 4   ..., the garbage collector must run any finalizers of objects being freed. Question... objects can be declared and manipulated by code in any package Question: What
Core Java Interview Question, Interview Question
Core Java Interview Question Page 13  ... to create objects that are not subject to garbage collection Question: What... by other objects. Question: What is the immediate superclass of the Applet class
Core Java Interview Question, Interview Question
Core Java Interview Question Page 14       Question: What is clipping? Answer: Clipping... that is implemented in a language other than Java. Question: Can
Core Java Interview Question, Interview Question
Core Java Interview Question Page 21       Question: How are the elements of a GridLayout... and are laid out using the squares of a grid. ADS_TO_REPLACE_1 Question: What an I/O
Core Java Interview Question, Interview Question
Core Java Interview Question Page 27       Modifiers Question: What are access modifiers... modifier then it is considered as Friendly Question: Can protected or friendly
Core Java Interview Question, Interview Question
Core Java Interview Question Page 30       Objects and Classes Question: What's... while regular methods could be called many times. Question: What

Ads