Can I use a C Macro in a java program?
The answer is YES, you can.
Java programming does not use macros, but you can use C macros in Java. To do that you can pipe the source code containing macro and Java code through the C preprocessor. Below is an example code:
Now, before you compile the Java code, pipe it to the C preprocessor:
cpp -P MacroTest.java macros/MacroTest.java
Note: Make sure all the folders are created properly before the source code is submitted to the C preprocessor.
Next, go to the macros directory to view the Java code generated by CPP.
No comments:
Post a Comment