This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

compile time error:missing return statement  RSS feed

 
satya narayan reddy
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • 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
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37242
519
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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.
 
Adam Richards
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
hi jaenne
Thanks for your suggestion errors are fixed.

thanks
satya
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!