Distance light travals Using of Long variable in java - LearnHowToCode SarkariResult.com Interview Questions and Answers LearnHowToCodeOnline
Distance light travals Using of Long variable in java

Distance light travals Using of Long variable in java

 Long 

 long is singed 64 bit type of and is useful for those hen occasions where an int type is not large enough to hold the desired value . the range or long is quite large. This makes is useful when big whole numbers are needed . for example.
here is a program that computer the numbers of miles that light will be travel in specified numbers of the days.



class Light{
  public static void main(String[]args)
  {
    int lightSpeed;
long days;
long seconds;
long distance;


lightSpeed=186000;
days=1000;
seconds=days*24*60*60;
distance=lightSpeed*seconds;
System.out.println("IN"+days);
System.out.println("days light will be travel about ");
System.out.println(distance+"miles");
   }

}

About EasyToCode

I'm Ethan Mariano a software engineer by profession and reader/writter by passion.I have good understanding and knowledge of AngularJS, Database, javascript, web development, digital marketing and exploring other technologies related to Software development.

0 comments:

Featured post

Political Full Forms List

Acronym Full Form MLA Member of Legislative Assembly RSS Really Simple Syndication, Rashtriya Swayamsevak Sangh UNESCO United Nations E...

Powered by Blogger.