2 Replies - 436 Views - Last Post: 16 August 2012 - 05:16 AM Rate Topic: -----

#1 mariie  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 14-August 12

how can i convert string to char in java ?

Posted 16 August 2012 - 04:54 AM

how can i convert string to char in java?
Is This A Good Question/Topic? 0
  • +

Replies To: how can i convert string to char in java ?

#2 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2831
  • View blog
  • Posts: 11,992
  • Joined: 20-September 08

Re: how can i convert string to char in java ?

Posted 16 August 2012 - 05:14 AM

(Where 's' is your String)

char c = s.charAt(0);

Was This Post Helpful? 0
  • +
  • -

#3 burakaltr  Icon User is offline

  • D.I.C Regular

Reputation: 92
  • View blog
  • Posts: 276
  • Joined: 07-November 10

Re: how can i convert string to char in java ?

Posted 16 August 2012 - 05:16 AM

 String s="hello";
	  char c[]=s.toCharArray();
	  


for(char c2:c)
	  System.out.println(c2);
  

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1