• 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

compile time error:missing return statement

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
public class StringMethods
{
static String str= "abc";
String name = "venkat";
String qualifi= "mca";

public void StringMethods2()
{
System.out.println("" +name.charAt(0));
System.out.println("" +name.compareTo(qualifi));
System.out.println("" +name.concat(qualifi));
//System.out.println("" +name.endsWith("t"));
}

public boolean endsWith(String str)
{
System.out.println("in the endsWith method");
}

StringMethods()
{
System.out.println("in the default constructor");

}
public static void main(String args[])
{
StringMethods sm = new StringMethods();
sm.StringMethods2();
System.out.println("" +str.charAt(2));
boolean b = sm.endsWith("r");
}
}

Hi all,
The above program is giving compile time errors.Can anybody fix the errors

Thanks,
reddy
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Satya,
The endsWith method isn't implemented. To get it to compile, you can write "return true;" Then later, you can actually implement it with logic.
 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tip: Simply asking people to "fix the errors" without even posting the error message is silly. Give people some information to work with.
 
satya narayan reddy
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi jaenne
Thanks for your suggestion errors are fixed.

thanks
satya
 
Hang a left on main. Then read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic