Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (1.5k points)

While executing this piece of code, i am getting output as 0.

public static void main(String[] args) {
    double g = 1 / 3;
    System.out.printf("%.2f", g);

How can I solve this? 

Please log in or register to answer this question.

Related questions

Browse Categories

...