• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

interface

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi ppl,
plz check the code and tell me where is the error....
interface keyin {
public String keyinput();
}
public class Test implements keyin {
static String ss;
public static void main ( String argvs []) {
System.out.println("Plz enter some string");
ss=keyin();
// System.out.println(ss);
}
public String keyinput() {
BufferedReader in= new BufferedReader(new InputStreamReader(System.in));
String str;
str= in.readLine();
return str;
}
}
well error is : METHOD KEYIN is not in class test
plz help wanteddddddddd sooooon
regards
Khurram fakhar
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Khurram
Because there is no keyin() method there ..the method name is keyinput()
Meena
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Khurram
change it like this
interface keyin {
public String keyinput();
}
public class Test implements keyin {
static String ss;
public static void main ( String argvs []) {
System.out.println("Plz enter some string");
Test t=new Test();
ss=t.keyinput();
// System.out.println(ss);
}
public String keyinput() {
BufferedReader in= new BufferedReader(new InputStreamReader(System.in));
String str;
str= in.readLine();
return str;
}
}
Now it should be fine..
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic