Total members 11808 |It is currently Thu Dec 12, 2019 3:34 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Starting from JDK7 you are allowed to put underscores between the digits number in primitives initialization step.In goal of increasing the readability of your java source code, at Java7 you can add underscore between the digits numbers for example:

Code:
long cardNumber = 3234_5431_6441_9876L; 
double mydouble
=323_123_3d;
Integer integer=32_43; 

There are places that you have to be careful about putting underscore there:
  • Before the Suffix (L or D).
  • At the start or end of a number.
  • Place of String of digits is required.
  • Before or after the floating point.
Example of a wrong usage for underscore with numbers assignment:
Code:
float fnumber = 53_.32F;
long VisaCard= 1111_1111_1111_L;
int intNum = _12;
 




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time

For this message the author DrRakha has received gratitude : Thilinalive
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : add underscore between the digits numbers
 add two 24-bit numbers (sum two numbers)     -  
 Complex Numbers     -  
 JProgressbar Sum of 'n' Numbers     -  
 The harmonic mean of two numbers is given by     -  
 The harmonic mean of two numbers is given by:     -  
 add sequence of decimal numbers     -  
 swap two numbers c++ program     -  
 Complex numbers calculator (C++)     -  
 multiply two numbers in PIC assembly     -  
 Remove ordered list numbers     -  



Topic Tags

Java Basics






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com