2 Replies - 502 Views - Last Post: 24 January 2011 - 02:18 PM Rate Topic: -----

#1 naina1990  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 24-January 11

i want the solution of code errors in java as a new programmer

Posted 24 January 2011 - 04:30 AM

abstract class media{
abstract public void display();
int price;
string title;
public media(int p,string t)
{
price=p;
title=t;
}
public void read(int p,string t){
price=p;
title=t;
}
public media(){}
}
class  cd extends media
{
int duration;
public cd(){}
public cd(int p,string t,int d){
super(p,t);
duration=d;
}
public void read(int d){
duration=d;
}
public void display()
{
System.out.println(title);
System.out.println(price);
System.out.println(duration);
}
}
class book extends media{
int pages;
public book(){}
public book(int p,string t,int y  ){
price =p;
title=t;
pages=pg;
}
public void read (int pg){
pages =pg;
}
public void display(){
System.out.println(title);
System.out.println(pages);
System.out.println(price);
}
}
class main
{
public static void main(sring args[])
{
cd c=new cd(250,"dabang",3);
c.display();
book b=new book(400,"java",400);
b.display();
}
}
]code to highlight[/abstract class media{
abstract public void display();
int price;
string title;
public media(int p,string t)
{
price=p;
title=t;
}
public void read(int p,string t){
price=p;
title=t;
}
public media(){}
}
class  cd extends media
{
int duration;
public cd(){}
public cd(int p,string t,int d){
super(p,t);
duration=d;
}
public void read(int d){
duration=d;
}
public void display()
{
System.out.println(title);
System.out.println(price);
System.out.println(duration);
}
}
class book extends media{
int pages;
public book(){}
public book(int p,string t,int y  ){
price =p;
title=t;
pages=pg;
}
public void read (int pg){
pages =pg;
}
public void display(){
System.out.println(title);
System.out.println(pages);
System.out.println(price);
}
}
class main
{
public static void main(sring args[])
{
cd c=new cd(250,"dabang",3);
c.display();
book b=new book(400,"java",400);
b.display();
}
}

This post has been edited by macosxnerd101: 24 January 2011 - 05:20 AM
Reason for edit:: Please use code tags


Is This A Good Question/Topic? 0
  • +

Replies To: i want the solution of code errors in java as a new programmer

#2 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10469
  • View blog
  • Posts: 38,809
  • Joined: 27-December 08

Re: i want the solution of code errors in java as a new programmer

Posted 24 January 2011 - 05:21 AM

And your question is?
Was This Post Helpful? 0
  • +
  • -

#3 Dogstopper  Icon User is offline

  • The Ninjaducky
  • member icon



Reputation: 2871
  • View blog
  • Posts: 11,026
  • Joined: 15-July 08

Re: i want the solution of code errors in java as a new programmer

Posted 24 January 2011 - 02:18 PM

Good Gosh! Fix your indenting! Knowing the exct errors that you are getting will help us help you.

However, there is a tutorial on common errors made by Java beginners:
http://www.dreaminco...wn-java-errors/
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1