This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Urgent General Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Urgent General Help" Watch "Urgent General Help" New topic

Urgent General Help

Sameer Shaikh

Joined: Aug 17, 2001
Posts: 1
Can any one tell me i want to write a string using the FileOutputStream the write method takes a byte[] as parameter can any one tell me whether any other possible way to write the string in the file , or any method which converts String to Byte[] .
syed fazal faheem

Joined: Jul 13, 2001
Posts: 12
You can convert string into an array of bytes using the following methods in String class:
1. public byte getBytes()[];
2. public void getBytes(int, int, byte[], int);
3. public byte getBytes(java.lang.String)[] throws;

check it out for urself:
just type "javap java.lang.String |more" at the command prompt
I agree. Here's the link:
subject: Urgent General Help
It's not a secret anymore!