30/03/2016

How to Print Different Type of Values in Java

Problem:- How to Print Different Type of Values in Java or Displaying Information using print() and println() Methods or Using generic methods to print array of different types or Data types in Java Learn about integer character float double long etc or Returning Multiple values in Java or how to print different type of values in java. java program for printing an integer, float, string, character and boolean values in java. string printing in java.

Check This:- HackerRank solution for C++ Domain.


Explanation:- As we know that we have different types of variable in Java such as Integer character float double long string and boolean, now in this problem we have to print these different type of variable. We also know that each variable has a different type of printing pattern like when we have to print character we use single quotes ( ' ' )and for string, we use double quotes ( " " ).


Also check- Geeksforgeeks solution for School Domain in C++.

Extreme Recommended:- Like our Facebook Page or Join our Facebook Group and Google plus Community for up-to-date for a new post or if you have any Query you can ask there with lots of coders also suggest to your Friends to join and like our page, so we can help our community, and don't forget to Subscribe. Enter your Email and click to subscribe.

How to Print Different Type of Values in Java


class Program2
{
public static void main(String[] args)
{
System.out.println(123456789);
System.out.println(235.254);
System.out.println('P');
System.out.println(true);
System.out.println("Prashant");
}
}



Output:-

How to Print Different Type of Values in Java

You May Also See


1. Java Program To Find Area And Circumference Of Circle

2. Java Program To Print ASCII Value Of Character

3. Java Program To Find Area Of Triangle

4. Java Program to Convert a person's name in Abbreviated

5. Java Program For Calculate A Simple Interest
Previous Post
Next Post

post written by:

2 comments: