10 Replies - 602 Views - Last Post: 23 November 2009 - 09:08 AM Rate Topic: -----

#1 alexandra1_1_1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 03-May 09

I CAN'T FIND THE ERROR!

Posted 22 November 2009 - 05:33 PM

public class Exigently <E1, E2, E3, E4> {
	private E1 e1;
	private E2 e2;
	private E3 e3;
	private E4 e4;

	Exigently(E3 v3, E1 v1, E4 v4, E2 v2) {
		e1 = v1;
		e2 = v2;
		e3 = v3;
		e4 = v4;
	}

	public E2 unerected(E1 arg) {
		c = true;
		return e2;
	}
	public static boolean c = false;
}


class Leprology {}

class Aerogram {}

class Trepang {}

class Decimate{}



public class Bridling{
   public static  Decimate clinoaxis() {

	  Aerogram a =new Aerogram();
	 Leprology l=new Leprology();
	Trepang t=new Trepang();
	 Decimate d=new Decimate();
	 Exigently <Aerogram,Leprology,Trepang,Decimate> xa;
	  d=unerected(Leprology);
	  return Decimate d;

   }
}



Is This A Good Question/Topic? 0
  • +

Replies To: I CAN'T FIND THE ERROR!

#2 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 9044
  • View blog
  • Posts: 33,555
  • Joined: 27-December 08

Re: I CAN'T FIND THE ERROR!

Posted 22 November 2009 - 05:41 PM

The error lies in this class:
public class Bridling{
   public static  Decimate clinoaxis() {

	  Aerogram a =new Aerogram();
	 Leprology l=new Leprology();
	Trepang t=new Trepang();
	 Decimate d=new Decimate();
	 Exigently <Aerogram,Leprology,Trepang,Decimate> xa;
	  d=unerected(Leprology);
	  return Decimate d;

   }
}



As you can see, the method unerected doesn't exist in this class. To use it, you have to call it from your Exigently object. However, you first have to initialize your Exigently object. Next, unerected is expected a variable of type E1, or in this case, Leprology, not the type itself. So you could pass the variable l, but not Leprology. Next, since d has been declared as a Decimate variable, you can just say return d;

If you did, however, need to return a new object, you would return it like so:
//replace Type with a valid Reference datatype
return new Type(); //for no-args constructor
return new Type(params); //for constructor w/params


Was This Post Helpful? 1
  • +
  • -

#3 japanir  Icon User is offline

  • jaVanir
  • member icon

Reputation: 1010
  • View blog
  • Posts: 3,025
  • Joined: 20-August 09

Re: I CAN'T FIND THE ERROR!

Posted 22 November 2009 - 05:45 PM

it is hard to say without seeing the full code, anyway, at first glance the errors are because the code in Bridling class
this code is wrong. you should call a method of class A from the scope of class B by referring the class A object.
 d=unerected(Leprology);


when not inside the class scope, you should call an object method as:
//the right way:
Exigently exObj = new Exigently(a,l,t,d);
d = exObj.unerected(l);


when creating a new object of Exigently, pass the variable's names, and not their dataTypes.

another problem:
return Decimate d;



no need to mention the type, it should be:
the right way:
return d;



fix the code as i suggested. post if you have other problems :^:
Was This Post Helpful? 1
  • +
  • -

#4 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8032
  • View blog
  • Posts: 31,202
  • Joined: 06-March 08

Re: I CAN'T FIND THE ERROR!

Posted 22 November 2009 - 08:36 PM

No wonder you can't find the error !!! Your code is an HORROR !!!

Use meaningful variable/class names THIS IS scandalous

This post has been edited by pbl: 22 November 2009 - 08:41 PM

Was This Post Helpful? 0
  • +
  • -

#5 alexandra1_1_1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 03-May 09

Re: I CAN'T FIND THE ERROR!

Posted 23 November 2009 - 07:55 AM

View Postjapanir, on 22 Nov, 2009 - 04:45 PM, said:

it is hard to say without seeing the full code, anyway, at first glance the errors are because the code in Bridling class
this code is wrong. you should call a method of class A from the scope of class B by referring the class A object.
 d=unerected(Leprology);


when not inside the class scope, you should call an object method as:
//the right way:
Exigently exObj = new Exigently(a,l,t,d);
d = exObj.unerected(l);


when creating a new object of Exigently, pass the variable's names, and not their dataTypes.

another problem:
return Decimate d;



no need to mention the type, it should be:
the right way:
return d;



fix the code as i suggested. post if you have other problems :^:

Quote

one more question....i think there is problem with the return type..compiler make errors with incompatible types...

Was This Post Helpful? 0
  • +
  • -

#6 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 9044
  • View blog
  • Posts: 33,555
  • Joined: 27-December 08

Re: I CAN'T FIND THE ERROR!

Posted 23 November 2009 - 08:14 AM

Have you just tried returning d as Japanir and I have been suggesting, like so:
return d;


Was This Post Helpful? 0
  • +
  • -

#7 alexandra1_1_1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 03-May 09

Re: I CAN'T FIND THE ERROR!

Posted 23 November 2009 - 08:30 AM

[indent]

View Postmacosxnerd101, on 23 Nov, 2009 - 07:14 AM, said:

Have you just tried returning d as Japanir and I have been suggesting, like so:
return d;


public class Bridling{
   public static Decimate clinoaxis() {

	  Aerogram a =new Aerogram();
	 Leprology l=new Leprology();
	Trepang t=new Trepang();
	 Decimate d1=new Decimate();
	 Decimate d2=new Decimate();
	 Exigently exObj = new Exigently(a,l,t,d1);
	 d2 = exObj.unerected(l);
	  return d2;
   }

[quote]i have do this but i have problems with compiler..
Was This Post Helpful? 0
  • +
  • -

#8 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 9044
  • View blog
  • Posts: 33,555
  • Joined: 27-December 08

Re: I CAN'T FIND THE ERROR!

Posted 23 November 2009 - 08:39 AM

Please respect rule #6 of this forum. If you want to ignore it, then you will get little to no help. It states:

Quote

Describe any errors you are encountering. Help us help you!


"Problems with my compiler" is extremely vague as it can produce 1 or 1000 errors.
Was This Post Helpful? 0
  • +
  • -

#9 alexandra1_1_1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 03-May 09

Re: I CAN'T FIND THE ERROR!

Posted 23 November 2009 - 08:52 AM

View Postmacosxnerd101, on 23 Nov, 2009 - 07:39 AM, said:

Please respect rule #6 of this forum. If you want to ignore it, then you will get little to no help. It states:

Quote

Describe any errors you are encountering. Help us help you!


"Problems with my compiler" is extremely vague as it can produce 1 or 1000 errors.

[quote]ok..you have right..sorry
found : java.lang.Object
required: Decimate
d = exObj.unerected(l);
when i try to run it i have this output from compile
Was This Post Helpful? 0
  • +
  • -

#10 alexandra1_1_1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 03-May 09

Re: I CAN'T FIND THE ERROR!

Posted 23 November 2009 - 09:07 AM

[quote name='alexandra1_1_1' date='23 Nov, 2009 - 07:52 AM' post='843289']

View Postmacosxnerd101, on 23 Nov, 2009 - 07:39 AM, said:

Please respect rule #6 of this forum. If you want to ignore it, then you will get little to no help. It states:

Quote

Describe any errors you are encountering. Help us help you!


"Problems with my compiler" is extremely vague as it can produce 1 or 1000 errors.

Quote

ok..you have right..sorry
found : java.lang.Object
required: Decimate
d = exObj.unerected(l);
when i try to run it i have this output from compile

Was This Post Helpful? 0
  • +
  • -

#11 Dophert  Icon User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 60
  • Joined: 19-October 09

Re: I CAN'T FIND THE ERROR!

Posted 23 November 2009 - 09:08 AM

View Postalexandra1_1_1, on 23 Nov, 2009 - 07:52 AM, said:

ok..you have right..sorry

   found   : java.lang.Object
required: Decimate
	 d = exObj.unerected(l);


when i try to run it i have this output from compile


d = (Decimate)exObj.unerected(l);


But you should just add a type to your E1, E2, E3 and E4. :s

public class Bridling{
	public static Decimate clinoaxis() {
		Aerogram a = new Aerogram();
		Leprology l = new Leprology();
		Trepang t = new Trepang();
		Decimate d1 = new Decimate();
		Decimate d2 = new Decimate();
		Exigently<Aerogram, Leprology, Trepang, Decimate> exObj = new Exigently<Aerogram, Leprology, Trepang, Decimate>(a,l,t,d1);
		d2 = exObj.unerected(l);
		return d2;
	}
}



EDIT: Quick thinking told me that isn't going to work, ever. You're mixing Leprology with Decimate, you're returning Leprology class when you need a Decimate, you're not extending one another. You need to remake your whole code completely.

This post has been edited by Dophert: 23 November 2009 - 09:11 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1