Can someone explain the concept of downcasting in java?

1 Answer

Answer :

Bruce Eckel’s Thinking in Java, a freely-available book (you can download the whole thing from his site), is excellent and his description and example of downcasting can probably explain the concept better than I can explain it…

Related questions

Description : Can someone explain Java?

Last Answer : 1) A programming language 2) Create web sites 3) You write programming statements and pass them to a Java interpreter on a Web server 4) Yes. Very! 5) No. Apps written in Java are very error prone. ... prone. Though if you know Java and are good at it, you can pretty much write your own ticket

Description : Ruby, a class XI student has just started learning java programming. Help her in the following: (i) Explain her the concept of variable -Technology

Last Answer : (i)Variables are named storage location to store values temporarily which can be changed during program execution.Data type states the way the values of that type are stored, the operations that can be done ... setText( Just Pass );In the above if statement, value of marks is being compared with 40.

Description : Explain the concept of platform independence and portability with respect to Java language.

Last Answer : Java is a platform independent language. This is possible because when a java program is compiled, an intermediate code called the byte code is obtained rather than the machine code. Byte code is a highly ... of the JVM will defer from platform to platform, all interpret the same byte code.

Description : Did my textbook make a mistake, or am I just misunderstanding this concept (linear algebra)?

Last Answer : The book is wrong and it is easy to demonstrate it. Let the coefficients of a1, a2 and a3 be X1, X2 and X3. From the first equation we have x1 = 2 - 5*X3 and from the second equation we have X2 = 3 - 4X3. We can ... . Let X3 = 1. Then X1 = 3 and X2 = -1. You can see directly that b = 3*a1 -a2 + a3

Description : The concept of multiple inheritance is implemented in Java by A) extending two or more classes B) extending one class and implementing one or more interfaces C) implementing two or more interfaces D) both B and C

Last Answer : D) both B and C

Description : The concept of multiple inheritance is implemented in Java by A) extending two or more classes B) extending one class and implementing one or more interfaces C) implementing two or more interfaces D) both B and C

Last Answer : D) both B and C

Description : Can someone explain to me schools that go by semesters?

Last Answer : answer:Usually the classes that are over a shorter period of time meet more often or for longer time period and require a lot more work at a time then the ones over 12 or more weeks. They are generally the ... with 2 the first time to get an idea of how much work you'll be doing in that 6 weeks.

Description : Can someone explain to me how grades work in the States?

Last Answer : As far as actual grades, 90% and above = A = 4 80-89% = B = 3 70-79% = C = 2 60-69% = D = 1 59% and below = F = 0 For each class you get a grade. That grade corresponds to a 0-4 number. They average those numbers and ... 2 Cs, 1 B, and 2 As. 4 + 4 + 3 + 2 + 2 = 15. 15/5classes = 3. Your GPA is 3.0.

Description : Can someone explain to me what's the thing with surface normal and friction force?

Last Answer : Force normal is the force facing upwards, perpendicular to the object. It is what prevents you from falling down when sitting on a chair. Frictional force can be in any direction depending on context. Imagine a ... are having trouble with? At this point, your Q what's the thing is rather vague.

Description : How do I start a friendship with someone?

Last Answer : Since you have classes together, you could ask him a question about a class topic. Keep it broad, so he has many ways to answer. Don’t ask a question that can be answered with us or no. Good luck.

Description : Can someone check my grammar and find a better way to write it?

Last Answer : Since a large part of English classes is to teach student how to write better by getting them to understand their own mistakes, what we should probably do is tell you what's incorrect about what you've ... * Mr.knightly -> Mr. Knightly again, and think about the tense of the last sentence.

Description : When is it legal to bribe someone?

Last Answer : It's always legal to bribe someone so long as it doesn't interfere with what's written in constitutional/local law. You can bribe a baby not to cry with candy, bribe a friend to do your ... politicians or law enforcement officers it'll be punishable by law as it has gone against their work ethics.

Description : Do you remember being jealous of someone in high school?

Last Answer : I’m high school to my best knowledge no one was dating. I found a cute girl my age and height and I told her that she was cute and I never saw her ever again.

Description : If someone has engineering experience, how long might it take to get a degree in industrial design?

Last Answer : Where did he get the E&C Engineering degree from? I think Universities look favorably on older students.

Description : Do you think it matters where someone sits on the bus, or at a lunch table?

Last Answer : This will stop after you get out of middle school or high school. Of course it’s not right. It’s immature.

Description : If someone received a bad education… would it be cool (or possible) if you could just ask for your money back?

Last Answer : answer:Do you mean received* a bad education? I think it would be uncool and legally your action may be time barred. Your admission to a school is voluntary (don't know about law in US about ... or so there may be something else wrong. The only way is to attempt to reform the educational system.

Description : How to have a decent conversation with someone you barely know?

Last Answer : Start with asking her about her interests, see if there is any common ground to hook into.’ Otherwise, just be BOLD girls like a take charge kinda guy. haha She might be thinking the same thing abut you!

Description : So what do you do when someone has a vendetta against you for something that happened ages ago?

Last Answer : Ask them to leave you alone or you will get a restraining order against them.

Description : Have you ever lived with someone of a different race or culture?

Last Answer : My husband – English and raised Anglican – and me – Jewish, American and raised erratically. We’ve driven each other bloody meshuggenah over the past 37 years.

Description : Can someone please help me with my final exam review?

Last Answer : Isn’t that cheating?

Description : Could someone give me a song with a good message?

Last Answer : Skunk Anansie – Yes It’s Fucking Political

Description : Can someone recommend a good highlighter that does not bleed?

Last Answer : This one is designed for use in bibles, and supposedly doesn’t bleed. I haven’t used it, but a friend of mine has, and she says it works. I don’t know how bright it is, but I imagine it’s good enough.

Description : What are the chances that someone who has spent their academic career in the humanities and social sciences could go back to school to study hard science and be successful?

Last Answer : I think it is definitely possible. If it is what you want, you can make it happen.

Description : When someone is in college, do you think it's better to live in a dorm or just stay at home?

Last Answer : If money is not an issue. I would always go for the dorm. Just to be closer to the good times and the parties.

Description : Can someone help me with ideas on starting an autobiography?

Last Answer : Well, here’s a bunch of ideas for a first sentence.

Description : Are you more likely to do something on your own terms rather than someone telling you?

Last Answer : I am definitely more likely to do something that I think of to do myself, it’s just my nature. So, sometimes you need to try and improvise a little and make it fun for yourself. If that doesn’t work, then you just have to buck up and do it! Procrastination is a bitch.

Description : When is it too long to ask for a letter of recommendation from someone?

Last Answer : IMO, stop by and check with him. It's always best practice to get the other person's OK so they know to maybe expect a call. I don't know that there is a time limit, as long as they can reasonably ... ex-bosses from 10 years ago that I still use. I always call her to let her know I used her again.

Description : Has anyone of you liked someone so much that you would've done anything for them even if you got in trouble?

Last Answer : Yes. I used to ditch classes to hang out with a guy I liked. I also broke my curfew and lied to my mom about where I was and I'd stay at his house. I'd tell my mom I was spending the night ... on me to see where I was. I went through gasoline like a demon driving back and forth to his house though.

Description : Can someone help me locate this book I read when I was in primary school?

Last Answer : Wasn’t this a movie?

Description : Can Someone Label This Heart For Me?

Last Answer : Are you asking us to do your homework? This seems pretty straightforward to me….. (Try google.com. You find lovely sites like this: http://webschoolsolutions.com/patts/systems/heart.htm#heart)

Description : Have you ever taken a class in school just because you had a crush on someone who would be in the class?

Last Answer : yup. Thats mainly how I ended up with a masters in evolutionary biology that I don’t need and never use.

Description : Someone please rephrase this for me?

Last Answer : no homework here, and certainly no plagiarism

Description : Can Someone please rephrase this for me?

Last Answer : The object of this experiment is to compare two different ways of measuring the initial velocity of a steel ball fired from a spring loaded gun.

Description : What line of work would you recommend for someone with my experience?

Last Answer : Just a shot in the dark, but what about IT support?

Description : Someone have something that can cheer me up?

Last Answer : like such as..

Description : What is a cool, creative, and relatively inexpensive way to ask someone to prom?

Last Answer : “Yo momma so smart, she thinks you should go to prom with me.”

Description : What would you do if someone in your class is stuck up and can't get over herself ??

Last Answer : answer:Ignore her. She doesn’t determine your value. If you want to piss her off, ignore her very obviously.

Description : Would you refuse for your child to take a government "required" standardized test? If so please explain how and why?

Last Answer : And as a side note, as a homeschool parent in Oregon, I wasn't given the option of not testing my daughter because the state required standardized testing of homeschoolers by a certified tester. We had to set up ... If they had, I would've waved my doctor's note at them, and told them to screw it.

Description : Explain the purpose of pow() method with the help of suitable java code. Also mention that pow() method belongs to which class? -Technology

Last Answer : pow() method, a mathematical method, helps in calculating the power of any number.For example:int num=2,power=4;int ans=Math.pow(num,power);t1.setText(''+ans);The above code will calculate the value of 24 and will give answer 16.pow() method belongs to math class.

Description : Explain static blocks in Java ?

Last Answer : Ans. A static initialization block is a normal block of code enclosed in braces, { }, and preceded by the static keyword. Here is an example: static { // whatever code is needed for ... system guarantees that static initialization blocks are called in the order that they appear in the source code.

Description : Explain EJB (Enterprise Java Beans) ?

Last Answer : Ans. EJB Provides a mechanism that make easy for Java developers to use advanced features in their components, such as remote method invocation (RMI), object/ relational mapping (that is, saving Java objects to a relational database), and distributed transactions across multiple data sources.

Description : Explain JMS ( Java Messaging Services ) ?

Last Answer : Ans. JMS Provides high-performance asynchronous messaging. It enables Java EE applications to communicate with non-Java systems on top of various transports.

Description : Explain multithreading in Java ?

Last Answer : Ans. 1. Multithreading provides better interaction with the user by distribution of task 2. Threads in Java appear to run concurrently, so it provides simulation for simultaneous activities. The ... this method cannot do anything elsewhile awaiting the arrival of another byte on the stream.

Description : Explain any two logical operator in java with example.

Last Answer : Logical Operators: Logical operators are used when we want to form compound conditions by combining two or more relations. Java has three logical operators as shown in table: Program demonstrating logical Operators public class ... & b = false a || b = true !(a && b) = true

Description : Explain the four access specifiers in Java.

Last Answer : There are 4 types of java access modifiers: 1. private 2. default 3. Protected 4. public 1) private access modifier: The private access modifier is accessible only within class. 2) ... : The public access specifier is accessible everywhere. It has the widest scope among all other modifiers.

Description : Explain dynamic method dispatch in Java with suitable example.

Last Answer : Dynamic method dispatch is the mechanism by which a call to an overridden method is resolved at run time, rather than compile time. When an overridden method is called through a superclass reference, Java determines which version ( ... ; // calling C's version of m1() ref.m1(); } }

Description : Explain the two ways of creating threads in Java.

Last Answer : Thread is a independent path of execution within a program. There are two ways to create a thread: 1. By extending the Thread class. Thread class provide constructors and methods to create and perform operations on a ... = new MyThread();  Thread t = new Thread(m);  t.start();  } }

Description : Explain the types of constructors in Java with suitable example.

Last Answer : Constructors are used to initialize an object as soon as it is created. Every time an object is created using the new' keyword, a constructor is invoked. If no constructor is defined in a class, java compiler creates ... of First Second Rectangle : "+ (r1.length*r1.breadth)); } }