Get the App
SLTechnology News&Howtos  ›  Development  › 

What are object invocation member variables and member instance methods in java

Shulou Source: shulou.com Published: 2022-06-03 05:04:31 09月11日 Update

This article shows you what the object invocation member variables and member instance methods are in java. The content is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Use objects to access members of a class:

Object name. Member variable

Object name. Member method ()

Default values for member variables:

Specific example code:

Public class StudentTest_01 {public static void main (String [] args) {/ / create object format, class name object name = new class name (); / / No parameter use method Student S2 = new Student (); s2.setName ("thousand fathom 1"); s2.setAge (25); System.out.println ("name:" + s2.getName ()); System.out.println ("Age:" + s2.getAge ()) System.out.println ("-"); / / use method Student s = new Student ("thousand fathom 2", 23) with parameters; System.out.println ("name:" + s.getName ()); / / null System.out.println ("age:" + s.getAge ()); / / 0 System.out.println ("-"); / / call member method s.study (); s.eat () }}

The above content is what are the object call member variables and member instance methods in java. Have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Tags: Member object method variable instance usage content parameter name age skill knowledge class name concise concise code that is article more format Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB vpn Apple Huawei NVidia