Can basic types be passed as references in java

In

Java, the method passes parameters, and if the parameter is a basic type, it is passed by value, so can it be passed by reference?

void func1() {
    int a = 1;
    func2(a);
    System.out.println(a); // 1
}

void func2(int a) {
    a = 3;
}

for example: the above code calls func2 in func1, hoping that the value of a can be changed to 3. Can it be implemented in java?
does not go through the return way.

The

function is similar to the following CPP implementation:

void func1() {
    int a = 1;
    func2(a);
    cout << a ; // 3
}

void func2(int & a) {
    a = 3;
}
Apr.02,2021

you can customize a class, such as User, which contains an an attribute.
when passing parameters, modify user.a


1, return (the author asks not to use this method, abandon)
2, upstairs methods
3, an as global variables, in func2, this.a = 3;

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3d34b-2c37d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3d34b-2c37d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?