Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Teach Your Child To Read

Powerful WordPress hosting for WordPress professionals

Disclosure: My content contains affiliate links.

31,167 questions

40,724 answers

573 users

How to convert character from string to ascii value in Java

1 Answer

0 votes
public class MyClass {
    public static void main(String args[]) {
        String s = "java programming";
         
        char ch = s.charAt(1); 
         
        int n1 = (int)ch;
        System.out.println(n1);
        
        int n2 = ch;
        System.out.println(n2);
    }
}
 
 
  
/*
run:
  
97
97
  
*/

 





answered Nov 27, 2019 by avibootz
edited Nov 27, 2019 by avibootz

Related questions

2 answers 89 views
1 answer 46 views
1 answer 94 views
1 answer 96 views
...