Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Accessing methods HELP!  RSS feed

 
Naf Rash
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you access/invoke a method from another class? Please could you provide an example.
 
David Maddox
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok here is an example
public class Dog{
public void bark(){
}
}

public class dogTest{
Dog dog= new Dog(); /*you create a dog object and it has all of its methods/*
dog.bark();
}
[ February 26, 2004: Message edited by: David Maddox ]
[ February 26, 2004: Message edited by: David Maddox ]
 
Naf Rash
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that you may have forgotten to post the example! Thanks.
 
Naf Rash
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ignore what I just said for some reason the code did not load earlier on. Sorry.
 
David Maddox
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah i hit the wrong button
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!