변수형 long을 사용한 간단한 예제입니다.

 

Java 의 자료형 중 하나인 long 을 활용한 간단한 예제 입니다.

 

*** 원문

Vlong.java

/*
* long is 64 bit signed type and used when int is not large
* enough to hold the value.
*
* Declare long varibale as below
*
* long = ;
*
* here assigning default value is optional.
*/

 

 

 

 

*** 소스

package com.redjava.java.variable;

import java.util.Date;

public class Vlong {
 
 public static void main(String[] args) {

    long timeInMilliseconds = new Date().getTime();
       System.out.println("Time in milliseconds is : " + timeInMilliseconds);   
  
 }

}

 

 

*** 결과

Time in milliseconds is : 1353309685380

 

 

블로그 이미지

슬픈외로움

개발이 어려워? 모든것엔 답이있다...

,

 

변수형 short을 사용한 간단한 예제입니다.

 

Java 의 자료형 중 하나인 short 를 활용한 간단한 예제 입니다.

 

*** 원문

Vshort.java

* short is 16 bit signed type ranges from ?32,768 to 32,767.

*
* Declare short varibale as below
* 
* short = ;
* 
* here assigning default value is optional.
*/

 

 

 

 

*** 소스

package com.redjava.java.variable;

public class Vshort {
 
 
 public static void main(String[] args) {
   short s1 = 50;
      short s2 = 42;

   System.out.println("Value of short variable b1 is :" + s1);
   System.out.println("Value of short variable b1 is :" + s2);
  
 }

}

*** 결과

Value of short variable b1 is :50
Value of short variable b1 is :42

 

블로그 이미지

슬픈외로움

개발이 어려워? 모든것엔 답이있다...

,