How to Get Macro Variables Into Java Variables

Java has a wide range of applications, but its programming versatility can be bolstered further with the incorporation of macro variables. These variables are convenient coding tools that use "symbolic substitution" -- where pre-coded symbols can stand in for text to which it is associated. This allows a program to respond automatically to certain data inputs. It also makes for greater efficiency, since they are coded to respond to changes in other parts of the code to keep a Java application cohesive and functional. Merging macro variables into Java variables is a relatively straightforward process.

Instructions

    • 1

      Open the Java code editor.

    • 2

      Set the assignment operator for a given variable. There are several different assignment operators in Java (for example, =, *=, /= and %=), each of which determine what the line of code is supposed to do with the information given.

    • 3

      Type the line of code:
      "import java.rmi.CreateException; import javax.ejb.MacroException;"

    • 4

      Input the following:

      "public void (String criminal, boolean) {UserTransaction tx = null;
      Connection con = null;
      try {
      // create a user transaction
      tx = sessionContext.getUserTransaction();
      tx.begin(); "

    • 5

      Copy the code for your macro variables into the Java code editor, following the code you input in step 4.

Related Searches:

References

  • "Effective Java"; Joshua Bloch; 2008

Comments

Related Ads

Featured