Avatar of rgb192
rgb192
Flag for United States of America asked on

new keyword in numberFormat class

package com.example.java;

import java.text.NumberFormat;

public class Main {

    public static void main(String[] args) {
	int R = 42;
    String fromR = Integer.toString(R);
    System.out.println(R);

    boolean Rb = true;
        Boolean.toString(Rb);
        System.out.println(Rb);


        long Rl = 100_000;
        //Long.toString(Rl);
        NumberFormat formatt = NumberFormat.getNumberInstance();
        String formatted = formatt.format(Rl);
        //with commas instead of underscore
        System.out.println(formatted);

    }
}

Open in new window




numberformatting

is this an existing class

why do I not need a NEW keyword

numberFormat object=new numberFormat()
Java

Avatar of undefined
Last Comment
Jan Louwerens

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
CPColin

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
mccarl

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Jan Louwerens

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
mccarl

@rgb192,

Do you have any further questions on this subject, or are you happy with the above comments?
rgb192

ASKER
so it is static and what is class under it in the factory
Jan Louwerens

The exact implementation class is unknown. It's only known that it implements the NumberFormat interface (which is what you should be programming to, anyway).
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23