Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What is the mana value in Java

Shulou Source: shulou.com Published: 2022-06-02 08:26:19 10月04日 Update

Java magic value is what, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

Magic number, magic number, magic value, this is one thing, different names.

The so-called magic value refers to the value that appears directly in the code, and its meaning can only be clearly understood in the part of the code described by this value.

Look at a piece of code

/ * *

* get all the dates of the current week

*

* @ return

, /

Public static List getRangeDayOfWeek () {

List list = new ArrayList ()

/ / date format conversion

SimpleDateFormat sdf = new SimpleDateFormat ("yyyy-MM-dd")

/ / time adjusted to this Monday

Calendar instance = Calendar.getInstance ()

Instance.set (instance.get (Calendar.YEAR), instance.get (Calendar.MONDAY), instance.get (Calendar.DAY_OF_MONTH), 0,0,0)

Instance.set (Calendar.DAY_OF_WEEK, Calendar.MONDAY)

/ / Circular printing

For (int I = 1; I

Tags: Magic code constants values dates help different clear not used things contents methods variables only names meanings pictures this numbers articles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information MariaDB Xiaomi Shulou Tech Info vpn