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

How to call a method of another class in a java project

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

The knowledge of this article "how to call another kind of method in the java project" is not quite understood by most people, so the editor summarizes the following contents, detailed contents, clear steps, and certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to call another kind of method in a java project" article.

1. Prime Minister, we will develop the tool to create a new java project, and then create a new class we can do by instantiating a class into an accessed object. The code is as follows:

Package public void Moved TincePublic class Move_Test {public void Moved () {int iMagnum; iDefin10; ytree 15; if (I > 5) {ytree 20; System.out.println ("call succeeded, the value of y is" + y ") }}}

In the code, we enter two quantities to actually set it to a fixed value.

two。 So in the second step, we are creating a new class, and then instantiating it, we can call the class in step 1. The code screenshot is as follows:

Package class Move_Test_moved {public static void main (String [] args) {Move_Test CM= new Move_Test (); CM.Moved () }} the above is the content of this article on "how to call another class method in a java project". I believe you all have some understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.

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

Development

Wechat

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

12
Report