What is it the method should do? Are you trying to find the stuff between the String start and String last? Or are start and last integer indexes to where you want to take your substring from?
A few pointers on why your code didn't compile:
Java is a case-sensitive language. Thus, String != string.
getPartFrom() is not a defined method of Java's String class. Instead, Java has a substring() method that will take the substring between two indices. Also, this method is not static so you must reference an object to call it (as opposed to using String.
, use var_name.
, where var_name is the name of your variable).
String hello = "Hello World!";
System.out.println("The first five letters of the string are " + hello.substring(0,5));
In your second attempt, you try to use return.
. It should simply be return [space] value;
([space] means any white space separation).
public static int value()
return 5; // return the value 5