• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

String methods remarks (Java OCA 8 Programmer I Study Guide)

 
Vincent Botteman
Greenhorn
Posts: 9
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have some remarks about the String methods described in chapter 3:
- page 109: the String method contains takes a CharSequence and not a String
- page 106: according to the API the method charAt throws IndexOutOfBoundsException (superclass of StringIndexOutOfBoundsException). Do we need to know the exact exception on the exam? A similar case: according to the API the String method substring throws IndexOutOfBoundsException but the StringBuilder method substring throws StringIndexOutOfBoundsException.
- Methods like isEmpty() and intern() are not mentioned. No chance these are used on the exam?
 
Roel De Nijs
Sheriff
Posts: 10666
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vince Botteman wrote:- page 109: the String method contains takes a CharSequence and not a String

Already mentioned and explained here.

Vince Botteman wrote:- page 106: according to the API the method charAt throws IndexOutOfBoundsException (superclass of StringIndexOutOfBoundsException). Do we need to know the exact exception on the exam? A similar case: according to the API the String method substring throws IndexOutOfBoundsException but the StringBuilder method substring throws StringIndexOutOfBoundsException.

Discussed here and here.

Vince Botteman wrote:- Methods like isEmpty() and intern() are not mentioned. No chance these are used on the exam?

I think if you would encounter the isEmpty() method on the exam, you'll probably know what's it's all about I just had a look in my K&B7 study guide and it also doesn't mention the isEmpty() method, so you'll probably won't encounter it on the exam.

The intern() method will definitely not be on the actual exam (it's even not covered on the much harder OCPJP exam). If you want some info about the method, you can read this excellent article about String literals and the String Literal/Constant Pool.

Hope it helps!
Kind regards,
Roel
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic