Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX:About deprecated methods

 
xi ruo
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the new method which replaces the old method over 1.3 version for jdk?
one:
new String(byte[],int,int,int);
tow:
String.getBytes(int,int,byte[],int);
thanks for your help.
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Xi,
Have you looked at the Sun J2SE API documentation for String?
This will tell you that the constructor String(byte[], int, int, int) is Deprecated. This method does not properly convert bytes into characters. As of JDK 1.1, the preferred way to do this is via the String constructors that take a charset name or that use the platform's default charset.
So you have a choice as to which constructor you use.
The getBytes(int,int,byte[],int) method has a similar declaration in the API documentation, telling you what method to use instead.
Regards, Andrew
[ September 06, 2003: Message edited by: Andrew Monkhouse ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic