can anyone help me with this?
. Given the Java String variable assignment
String sentence = "This is a sample sentence";
what will the following sequence of Java statements print? Explain why Java will print this result.
String x = sentence.substring(4, 10);
System.out.println(x);

thanks a lot!!!

You need to visit the Java 6 API, more specifically the String class in the API, and inside that you have all the methods that the String class have, among them is the substring(int beginIndex, int endIndex) method. For any questions about Java classes and methods you can always use the API - this is its purpose ;).

You need to

  1. Keep It Organized - Do post Java questions in the Java forum
  2. Keep It Organized - Do provide evidence of having done some work yourself if posting questions from schoolwork assignments
  3. Understand: We only give homework help to those who show effort
  4. Keep It Organized: Do make sure to use the link at the bottom to mark it solved if it is solved and you are the original poster
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.