We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,275 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Macro in Java

Hi, I have to write a simple Java code real quick and was wondering how to write the following macro in Java:

#define BUF 256
4
Contributors
3
Replies
2 Years
Discussion Span
2 Years Ago
Last Updated
5
Views
Question
Answered
wolfcode
Newbie Poster
1 post since Mar 2008
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

There are no macros in Java. You would define a class or interface constant for that purpose.

Ezzaral
null
Moderator
16,111 posts since May 2007
Reputation Points: 3,292
Solved Threads: 873
Skill Endorsements: 28
Question Answered as of 4 Years Ago by Ezzaral

You probably would do something like:

public final static int buf = 256;

It's not exactly the same thing but performing about as good as it gets. It's comparable to a const.

rernst
Newbie Poster
1 post since May 2009
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

hi 'rernst' recently a friend of mine asked me to convert a c++ coded pgm to java codes
and there was macro [ #define f(x) x*x*x ] how do get java equivalent code for this?
using a function call is undesirable for this pgm ....can u help on this

alwinnjavaroor
Newbie Poster
2 posts since Oct 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0602 seconds using 2.67MB