Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Java int help

Featured Replies

Is there any way to make Java pass ints by reference and not value?

Not just ints, but doubles, floats, short, byte, long, etc.

^ All of these pass by value, not reference.

7 minutes ago, Noidlox said:

Is there any way to make Java pass ints by reference and not value?

Not just ints, but doubles, floats, short, byte, long, etc.

^ All of these pass by value, not reference.

It's not really do-able in Java.

EDIT: You could pass an int[].

Edited by Container

Java is a pass by value and Integer is immutable. So no, you cannot pass an ints reference in the arguments of a method.

8 hours ago, Vilius said:

Java is a pass by value and Integer is immutable. So no, you cannot pass an ints reference in the arguments of a method.

Makes sense. Thank you

9 hours ago, Container said:

It's not really do-able in Java.

EDIT: You could pass an int[].

With arrays you can.... Interesting

Just... wrap it in an object.

 

public class MutableInteger {  
  
  private int value; 
  
  public int getValue() {
    return value;
  }  
  
  public void setValue(int value) { 
    this.value = value;
  } 
  
}

1 hour ago, Botre said:

Just... wrap it in an object.

 

public class MutableInteger {  
  
  private int value; 
  
  public int getValue() {
    return value;
  }  
  
  public void setValue(int value) { 
    this.value = value;
  } 
  
}

Getters and setters to the rescue.

I'm writing this down. Thank you!

15 hours ago, Vilius said:

Java is a pass by value and Integer is immutable. So no, you cannot pass an ints reference in the arguments of a method.

^ my bad, haven't tested it, figured it was worth a shot. if you need it, then i'd just make a class with an int field

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.