Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the mana value in Java

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report