Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,855 questions

51,776 answers

573 users

How to set value to Float object in Java

4 Answers

0 votes
package javaapplication1;

public class JavaApplication1 {

    public static void main(String[] args) {

        float f = 3.14f;
        
        Float fObj = f;
        System.out.println(fObj);
    }
}
   
/*
      
run:
      
3.14
  
*/

 



answered Nov 8, 2016 by avibootz
0 votes
package javaapplication1;

public class JavaApplication1 {

    public static void main(String[] args) {

        Float fObj = 3.14f;
        System.out.println(fObj);
    }
}
   
/*
      
run:
      
3.14
  
*/

 



answered Nov 8, 2016 by avibootz
0 votes
package javaapplication1;

public class JavaApplication1 {

    public static void main(String[] args) {

        Float fObj = new Float(3.14);
        System.out.println(fObj);
    }
}
   
/*
      
run:
      
3.14
  
*/

 



answered Nov 8, 2016 by avibootz
0 votes
package javaapplication1;

public class JavaApplication1 {

    public static void main(String[] args) {

        Float fObj = new Float("1.199");
        System.out.println(fObj);
    }
}
   
/*
      
run:
      
1.199
  
*/

 



answered Nov 8, 2016 by avibootz

Related questions

3 answers 236 views
4 answers 292 views
292 views asked Nov 8, 2016 by avibootz
3 answers 216 views
3 answers 399 views
399 views asked Nov 8, 2016 by avibootz
3 answers 213 views
3 answers 270 views
270 views asked Nov 8, 2016 by avibootz
...