java - how to convert a String into a character array without .toCharArray instance method -


// have prompt user input string , store char [] array // know can use .tochararray instance method store string // character array.  // not have use method, reference string input // char array got compiler error saying cannot convert string char  // have done far import java.util.scanner; 

/** program prompts user input string , outputs entire string uppercase letters. */

public class stringuppercase {     public static void main(string [] args)     {         string input;         scanner keyboard = new scanner(system.in);          system.out.println("please enter string " );         input = keyboard.nextline();          char[] name;      } }  

here code snippet convert string char array , output in uppercase.

public static void main(string[] args)     {         string inputstring;         system.out.println("please enter string");         scanner sc = new scanner(system.in);         inputstring = sc.nextline();         sc.close();         int len=inputstring.length();         char[] name = new char[len];         for(int =0; < len; i++)         {             name[i] = inputstring.touppercase().charat(i);         }         system.out.println(name);     } 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -