GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — java-basics/core-java/wrapperclasses/NumberClass.java at master · learning-zone/java-basics

Expand file tree

/

NumberClass.java

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
23 lines (19 loc) · 985 Bytes
/

NumberClass.java

Copy path

File metadata and controls

23 lines (19 loc) · 985 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package wrapperclasses;
public class NumberClass {
public static void main(String[] args) {
Double d = new Double("6.9685");
byte b = d.byteValue();
Integer i = new Integer("10");
System.out.println("After conversion to byte: " + b); // 6
System.out.println("Compare: " + i.compareTo(7)); // 1 >> greater
System.out.println("Compare: " + i.compareTo(11)); // -1 >> less
System.out.println("Compare: " + i.compareTo(10)); // 0 >> equal
System.out.println("Equals: " + i.equals(10)); // true
System.out.println("ParseInt: " + Integer.parseInt("101", 2)); // 5
System.out.println("ParseInt: " + Integer.toBinaryString(10)); // 1010
System.out.println("ParseInt: " + Integer.valueOf(33)); // 33
System.out.println("Letter Character Class: "+ Character.isLetter('A')); // true
System.out.println("Digit Character Class: "+ Character.isDigit('0')); // true
System.out.println("Whitespace Character Class: "+ Character.isWhitespace('9'));
}
}
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.