Explain term literals in java, JAVA Programming

Assignment Help:

Explain term Literals in java?

Literals are pieces of Java source code which mean exactly what they say. For example "Hello World!" is a String literal and its meaning is the words Hello World!

The string "Hello World!" looks like it's various things; but to the compiler it's only one thing, a String. This is same to how an expression such as 1,987,234 may be seven digits and two commas but is actually just one number.

The double quote marks tell you this is a string literal. A string is an prearranged collection of characters (letters, digits, punctuation marks, etc.). While the String might have meaning to a human being reading the code, the computer sees it as no more than a particular set of letters in a particular order. It has no concept of the meaning of the characters. For example it does not know that "two" + "two" is "four." Actuallythe computer thinks in which "two" + "two" is "twotwo"

The quote marks display where the string starts and ends. Therefore the quote marks themselves are not a elements of the string. The value of this string is Hello World!, not "Hello World!" You can modify the output of the program through changing Hello World to a few other line of text.

A string in a Java program has no concept of italics, bold face, font family or other formatting. It cares just about the characters in which compose it. Even if you're using an editor such as NisusWriter that lets you format text files, "Hello World!" is identical to "Hello World!" as far as Java is concerned.

char literals are same to string literals except they're enclosed in single quotes and must have precisely one character. For example 'c' is a char literal which means the letter c.

true and false are boolean literals which mean true and false.

Numbers can also be literals. 34 is an int literal and it means the number thirty-four. 1.5 is a double literal. 45.6, 76.4E8 (76.4 times 10 to the 8th power) and -32.0 are also double literals.

34L is a long literal and it means the number thirty-four. 1.5F is a float literal. 45.6f, 76.4E8F and -32.0F are also float literals.


Related Discussions:- Explain term literals in java

Need to develop a small android app, Need to develop a Small Android App us...

Need to develop a Small Android App using Text to speech and Speech to Text feature. Project Description: When the Android App Opens, It will connect to Windows Azure cloud,

Developed an asteroids game, In the previous assignments, we have developed...

In the previous assignments, we have developed an Asteroids game. In this assignment, we are going to use the same codebase to develop a different gameplay. The inspiration for thi

Design a scheduler in java, Your task is to design a scheduler for the Sher...

Your task is to design a scheduler for the Sheridan Rail Corporation which keeps track of all daily scheduled trips for the railway.  Users can add new trips as well as perform sea

Java remote method invocation (RMI) architecture, Java Remote Method Invoca...

Java Remote Method Invocation (RMI): It gives a way for a Java program on one machine to interact with objects residing in different JVMs. The important blocks of the RMI arc

Android app for username and password, Hi, I have an android sdk assignment...

Hi, I have an android sdk assignment which is due monday night. The user will enter the following information. url address www.google.com user name [email protected] password 12

Minimumshelf, Write a program that finds the minimum total number of shelve...

Write a program that finds the minimum total number of shelves, including the initial one required for this loading process

What is testing for equality in java, What is Testing for Equality in java?...

What is Testing for Equality in java? Testing for equality is a little trickier. You would expect to test if two numbers are equal through using the = sign. However the = sign

Retrieving file records randomly, how to retrieve multiple records randomly...

how to retrieve multiple records randomly from a file and store it in another file

I need to make clone of an android app, I need to Make clone of an Android ...

I need to Make clone of an Android app Project Description: Make a total duplicate of the App: Camp and RV Campgrounds Plus The only difference will be the name (as it

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd