What is white space explain proper use of white space java, JAVA Programming

Assignment Help:

What is White Space? explain proper use of white space in java?

White space consists mainly of the space character in which you generates through hitting the space bar on your keyboard and in which is generally used to separate words within sentences. There are four other white space characters in Java, the horizontal tab, the create feed, the carriage return, and the linefeed. Depending on your platform, while you hit the return or enter key, you obtain either a carriage return (the Mac), a linefeed (Unix) or both (DOS, Windows, VMS). This generates a hard line break within the source code text.
Outside of String literals Java treats all white space and runs of white space (more than one white space character within immediate succession) the similar. It's used to separate tokens, and one space is as excellent as seven spaces, a tab and two carriage returns. Exactly that white space characters you use is primarily a result of what's convenient for human beings reading the code. The compiler doesn't care.

Inside String and character literals the just white space permitted is the space character. Carriage returns, tabs, line feeds and form feeds must be inserted along with special escape sequences like \r, \t, \f, and \n. You cannot break a String across a line like this:

String poem = "Mary had a little lamb
whose fleece was white as snow
and everywhere that Mary went
the lamb was sure to go.";
Instead you must use \n and the string concatenation operator, +, like this:
String poem = "Mary had a little lamb\n" +
"whose fleece was white as snow\n" +
"and everywhere that Mary went\n" +
"the lamb was sure to go.";

Remember that you can break a statement across multiple lines, you only can't break a String literal.
Also note that \n only works on Unix. You should probably use System.getProperty("line.separator") instead to return the proper line separator string for the platform your program is running on.

Java does not have all the escape sequences C has. Besides those already described it has only \b for backspace, \\ for the backslash character itself.

There are also \u escapes in which let you include any Unicode character.

The proper use of white space in programs
• Blank lines to separate blocks
• Use spaces instead of tabs


Related Discussions:- What is white space explain proper use of white space java

I need java web applications development, I need Java Web Applications Deve...

I need Java Web Applications Development Project Description: MySQL databases, Oracle. SVN, GIT team collaborations. Skills required: Java, SQL, Software Architectur

Methods in java, public class Foothill {    public static void main(String[...

public class Foothill {    public static void main(String[] args)    {       Client person_1 = new Client("Bruce Ruprecht", 16000, 10);       Writer writer_1 = new Writer("Adam Buf

What are different parts of autowire types, There are four different parts ...

There are four different parts by which autowiring can be done. ? byName ? constructor ? autodetect ? byType

Moving test, After refactor the main class to become abstract class, I want...

After refactor the main class to become abstract class, I want to move test method from tset clas of main class to subclass, how to do that?

Calculate Bill program, Notice that each row now has the type of customer a...

Notice that each row now has the type of customer and the additional data needed. calculateBill remains the same in Customer.  However, the calculateBill in Corporate will add a

Development of an android app urgent, Development of an Android app urgent ...

Development of an Android app urgent Project Description: I am searching for some good android developer who has depth in knowledge of making an app. I am focusing on a certa

Develop a custom android app, Develop a Custom Android App Project Descr...

Develop a Custom Android App Project Description: We want you to construct a custom Android app. Once user downloads the app and upon installation the user gets push notif

Java , Create an object model for the Solar System using the following link...

Create an object model for the Solar System using the following link: Provide">http://airandspace.si.edu/etp/ss/index.htm Provide an abstract class called Planet and a concrete s

Explain super class and sub class in java, 1. In Java (and OOP), Inheritanc...

1. In Java (and OOP), Inheritance includes the concept of super class that is parent class and sub class that is derived class. Explain What is a super class in Java? What is a sub

Illustrate the method to print on the GUI, Illustrate the method to print o...

Illustrate the method to print on the GUI Example Code: Taking Input / Output So far, we learned how to print something on console. Now time has come to learn how to print

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