how do i de define keyword

i want to define keywords like the #define in c++ because ts is better than this
11 Replies
JavaBot
JavaBot7mo ago
This post has been reserved for your question.
Hey @handsome asian! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
straightface
straightface7mo ago
you cant in java
treegus
treegus7mo ago
well, you can do like that just use
public static final int MAX_NUMBER = 5
public static final int MAX_NUMBER = 5
but you can't define methods.
JavaBot
JavaBot7mo ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
coolsigma103
coolsigma103OP7mo ago
no single way?
treegus
treegus7mo ago
well, There is lambda method. I can't know you want this.
public static final Function<String, String> GREET = name -> "Hello, " + name + "!";
public static final Function<String, String> GREET = name -> "Hello, " + name + "!";
It is lambda
coolsigma103
coolsigma103OP7mo ago
i mean keyword "this" to "ts" just like #define in c++
treegus
treegus7mo ago
just use
public static final String ts = "this"
public static final String ts = "this"
I can't know perfectly. I think making "this"(String) to "ts"(String) maybe cant
JavaBot
JavaBot7mo ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
coolsigma103
coolsigma103OP7mo ago
no, this, this.pissedMeOff()
JavaBot
JavaBot7mo ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.

Did you find this page helpful?