Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners method over riding
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


deepa gopalsamy
method over riding
1 Answer(s)      3 years and 4 months ago
Posted in : Java Beginners


write a java program to compute volume of sphere and volume of cylinder using method over riding


Advertisement
View Answers

June 30, 2011 at 12:04 PM


class Sphere {
double volOFSphere;
Sphere(double r){
volOFSphere =(4*3.14*r*r*r)/3;
}
void volume() {
System.out.println("Volume of Sphere: " + volOFSphere);
}
}
class Cylinder extends Sphere {
double volOfCylinder;
Cylinder(double r,double h) {
super(r);
volOfCylinder = 3.14*r*r*h;
}
void volume(){
super.volume();
System.out.println("Volume of Cylinder: " + volOfCylinder);
}
}
class MethodOverriding{
public static void main(String args[]) {
Cylinder c = new Cylinder(10, 20);
c.volume();
}
}


Related Tutorials/Questions & Answers:
method over riding
method over riding  write a java program to compute volume of sphere and volume of cylinder using method over riding
Transmitting messages over net
Transmitting messages over net  A method whereby messages to be transmitted between computers are all sent to a central computer, which gathers them and routes them to the appropriate destinations is known as - 1. Message
Advertisements
Call UIViewController over RootViewController
Call UIViewController over RootViewController   Hi, i have created the window based application.. but not sure how to call the UIView over RootViewController. Thanks
mouse over effects in css
mouse over effects in css  I have written a mouse over effect in CSS. But it is not working in HTML. Can any one suggest me? Thanks
Data over Voice Communication
Data over Voice Communication  I just Want to know that Data Over Voice communication is possible in India or Not, If not then Why. and If Yes then Why Please anyone give the answer
application over https
application over https   Hi. This questions might be very simple but I would like to create a simple servlet program and want to access using https... while accessing https over http
hibernate over Jdbc
hibernate over Jdbc  Why use hibernate over Jdbc?   Hibernate provides lots of advantages over JDBC. Some of them are as below: 1) Hibernate is data base independent 2) Hibernate provides its own query language called
Installing programs over a network
Installing programs over a network  Hi, i want to write a java program that will allow me to install programs from a server to a client machine. Any help will be appreciated. Thanks
Installing programs over a network
Installing programs over a network  Hi, i want to write a java program that will allow me to install programs from a server to a client machine. Any help will be appreciated. Thanks
Installing programs over a network
Installing programs over a network  Hi, i want to write a java program that will allow me to install programs from a server to a client machine. Any help will be appreciated. Thanks
Installing programs over a network
Installing programs over a network  Hi, i want to write a java program that will allow me to install programs from a server to a client machine. Any help will be appreciated. Thanks
Installing programs over a network
Installing programs over a network  Hi, i want to write a java program that will allow me to install programs from a server to a client machine. Any help will be appreciated. Thanks
Installing programs over a network
Installing programs over a network  Hi, i want to write a java program that will allow me to install programs from a server to a client machine. Any help will be appreciated. Thanks
RMI over Internet - RMI
RMI over Internet  Hello I've made a project which utilizes rmi for communication. Problem: I am unable to communicate using rmi over internet 1)the clients cannot connect to me 2)I am using client side callbacks 
Image writing over URLConnection
Image writing over URLConnection  Hello, I am trying to write an image over an HttpURLConnection. I know how to write text but I am having real problems trying to write an image I have succeeded in writing to the local HD using
method
method   how and where, we can define methods ? can u explain me with full programme and using comments
method
method  can you tell me how to write an abstract method called ucapan() for B2 class class A2{ void hello(){ system.out.println("hello from A2"); }} class B2 extends A2{ void hello(){ system.out.println("hello from B2
why should we over ride hashCode(), when equals was over ride()?
why should we over ride hashCode(), when equals was over ride()?  why should we over ride hashCode(), when equals was over ride
What is the advantage of hibernate over JDBC?
What is the advantage of hibernate over JDBC?  HI, What is the advantage of hibernate over JDBC? thanks
What is the advantage of hibernate over JDBC?
What is the advantage of hibernate over JDBC?  HI, What is the advantage of hibernate over JDBC? thanks
How to iterate over a checkbox group
How to iterate over a checkbox group  Hi. I am new to using JQuery and would much appreciate your help. I have a form on which I've created 5..." groups. My plan of attack was to iterate over the MASTER checkbox group
JavaScript fontColor method
the method fontColor() over any string instead of using the <font></font> tags. The fontcolor() method in JavaScript can be used to color strings... JavaScript fontColor method   
VoIP Over Cable
VoIP Over Cable          Introduction of VoIP Over Cable Cable operators... and voice service over the same cable spectrum. Voice (and fax) service over
Compression of rolled-over files using log4j
Compression of rolled-over files using log4j  How can I use log4j to rollover the log files on hourly basis and compress the rolled over files
Image swap on mouse over and mouse move
Image swap on mouse over and mouse move  i tried the code , sent form u...But if there are 50 images and..i want swap images on mousse over and mouse out, then the code becomes very lengthy...so please give the code for multiple
Image swap on mouse over and mouse move
Image swap on mouse over and mouse move  i tried the code , sent form u...But if there are 50 images and..i want swap images on mousse over and mouse out, then the code becomes very lengthy...so please give the code for multiple
a competitive study on cryptography techniques over block cipher
a competitive study on cryptography techniques over block cipher  i need "a competitive study on cryptography techniques over block cipher" project source code... plz reply to my post... for more information about this project
Method overriding
Method overriding  can a method declared in one package be over ridden in a different package?   A subclass in a different package can only override the non-final methods declared public or protected
Installing programs over a network using java
Installing programs over a network using java  Hi, i want to write a java program that will allow me to install programs from a server to a client machine. Any help will be appreciated. Thanks
VoIP Over WiFi
VoIP Over WiFi          A VoIP Over WiFi with work in Progress  The 802.11... in making VoIP run over WiFi -pesky little details like bandwidth assurance
UIPopOverController - Open a second PopOverController over first UIPopOverController
UIPopOverController - Open a second PopOverController over first UIPopOverController  How can i open a second UIPopoverController over my first UIPopoverController in my iPad application? Right now my first UIPopoverController
 

 

 

DMCA.com