• 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
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

String methods

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Given the following snippet:
______________________________

if( "String".endsWith(""))
Sytem.out.println("True");
else
System.out.println("False");
______________________________
The code produces
1.True
2.False

Correct answer is 1.true

--------------------
Another snippet given:

if( "String".startsWith(""))
Sytem.out.println("True");
else
System.out.println("False");
____________________________

The code produces
1.True
2.False

Correct answer : 1.True.

Are the methods "startsWith()" and "endsWith()" in the scope of SCKP1.4 exam?
If yes, can anyone the send me the appropriate link about these methods?
What are the other specific methods related to Strings that are to be known for the exam?

Thanks in advance,
rajani.
 
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Knowing the various methods of the String class is not a stated objective according to Sun's Site.

That said, String is a very commonly used object in Java and it would behoove you to be familiar with the methods defined therein. There's something to be said for someone that knows enough to pass the SCJP exam and then there's something else about someone that actually knows Java.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic