Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to print multiple 'char' types on one line

I’m new to java and I’ve searched stackoverflow for a simple answer but I cant see a simple answer.

How do i simply print ‘H.A.O’

public class Main {

    public static void main(String[] args) {
        char initial1 = 'H';

        char initial2 = 'A';

        char initial3 = 'O';

        System.out.println(initial1+'.'+initial2+'.'+initial3);
    // write your code here
    }
}

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

    System.out.println(initial1+"."+initial2+"."+initial3);

use double qoutes instead of single

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading