HomeJava

Java for Testers – Assigning different types of literals to the String non-primitive data type variable

Java for Testers – Assigning different types of literals to the String non-primitive data type variable

<<Previous Post                    << Complete Tutorial>>                        Next Post>>

In the previous article, I have explained about assigning different types of literals to the boolean data type variable.

In this article, I am going to explain about assigning different types of literals to the String non-primitive data type variable.

Java for Testers – Assigning different types of literals to the String non-primitive data type variable

String non-primitive data type variable only allows you to assign the String literal values (i.e. the sequence of characters in between double quotes).

But on trying to assign the literals other than String type, Java will give you a compiler error.

The below are the screenshots of the compiler errors displayed on assigning the literals other than String type:

String assign different - int

String assign different - long

String assign different - float

String assign different - double

String assign different - character

String assign different - boolean

Here conclude this article on assigning the different types of Literals to the String data type variable in Java.

In the next article, I will explain the remaining things about data types.

Next Steps:

  • > To learn more about Java, continue to the next post (Click on Next Post link below)
  • > Check complete Java Tutorial Contents here (Click here)

Please leave your questions/comments/feedback below:

Happy Learning ?

Arun Motoori (www.QAFox.com)

On a mission to help the Testing Community in all possible ways.

<<Previous Post                    << Complete Tutorial>>                        Next Post>>

Comments (0)

Leave a Reply

Your email address will not be published. Required fields are marked *

For FREE Testing Tutorials & Videos

X
Open chat
Contact Us on Whatsapp