• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

urgent help

 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
public class B {
static String[] s1;
static String[] s2;
private String a;
private String b;
private String c=null;
.
.
public static void main(String args[]) {
for( int r=0; r< s1.length; r++) {
for(int t=0; t< s2.length; t++) {
foo(s1[r], s2[t]); // forming string arrays s1 & s2
}
}
} // main - end
public void method()

{

A a1 = new A();

String kd = a1.foo(a, b, c);
}
} // class - end
*******************************************************
public class A {
public String foo(String a, String b, String c)
{
return "hai";
}
}
**************************************************
class B's foo(s1[r], s2[t]) shows the compilation error ? why ?
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can see using this post as an example of "How Not To Get Help On JavaRanch"
1. "urgent help" - tells us nothing about what the problem is "why this compilation error" would be the minimum informative subject.
2. code NOT presented in the code tags, making it hard to read
3. simple problem posted in the advanced Java section
4. actual compilation error - which probably contains the solution to your problem - not shown.

Bill
 
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could be that class A is not in the same package and in class B, package of A is not imported.
Need more details to help you.
Dan.
 
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe I'm blind, but in class "B" I see some instance and static variables, a "public static void main(...)" method and a "method()" method, but there is no method named "foo()" that takes two String parameters. If I were a compiler I'd complain too.
You need to define a "foo" method in class "B" before you can invoke it ...
 
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A tough question???
[ February 19, 2004: Message edited by: Murat Balkan ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic