java - Is "long x = 1/2" equal to 1 or 0, and why? -


इस सवाल का पहले से ही एक उत्तर है: < 9 जवाब

अगर मेरे पास कुछ ऐसा है तो:

  • <पूर्व> लंबा x = 1/2;

    इसे 1 तक गोल नहीं किया जाना चाहिए? जब मैं इसे स्क्रीन पर प्रिंट करता हूं तो इसे 0 कहते हैं।

  • यह पूर्णांक प्रभाग कर रहा है, जो हर चीज को छोटा करता है दशमलव बिंदु के ठीक ऊपर।


    Comments

    Popular posts from this blog

    .net - C# List<T>.Find(x=>x.Rectangle.Contains(Point)) FAIL -

    iphone - Smoothing a rounded stroke in Core Graphics -

    c++ - QtQuick: QQmlApplicationEngine failed to load component qrc:/main.qml:23 Invalid attached object assignment -