Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What points should be paid attention to in java initialization variables?

Shulou Source: shulou.com Published: 2022-05-31 10:53:20 10月03日 Update

This article mainly introduces "what points should be paid attention to in java initialization variables". In daily operation, I believe many people have doubts about what points java initialization variables should pay attention to. Xiaobian consulted all kinds of data and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "what points should be paid attention to in java initialization variables". Next, please follow the editor to study!

1. A variable is a field in a class or structure. If there is no obvious initialization, the variable is created by default, and the default initial value is 0.

2. the variables in the method must be initialized explicitly, otherwise there will be errors in using variables.

Example

Public class BedAndBreakfast {/ / initialize to 10 public static int capacity = 10; / / initialize to false private boolean full = false;} at this point, the study of "what points to pay attention to in java initialization variables" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Tags: Variables learning methods more help practical obvious next fields examples articles states theories knowledge articles structures websites materials follow questions Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi MySQL OPPO Reno Huawei MariaDB