OP Passing methods

Soz, the other post seemed to be getting a bit long. Everything is working great now guys, just 1 little problem, I will post all the code so that you can see. And just in case this makes a difference but all three of these classes are on seperate pages but i do have them all up and compiled when i use them together.
So this is my first class, it creates an album object:
import javax.swing.*;
public class Album
String CDname;
public Album (String cd)
CDname= cd;     
}Then i have my album list class which has many methods and at the bottom it creates a new list using the insert method:
import javax.swing.*;
public class AlbumList
final int DEFAULT_SIZE = 6;
int count;
Album[] data;
String[] list;
public AlbumList()
data = new Album[DEFAULT_SIZE];
count = 0;
public AlbumList(int size)
data = new Album[size];
count = 0;
public void insert( Album  myAlbum )
data[count] = myAlbum;
count++;
public void remove()
count--;
public Album[] getList()
return data;
AlbumList myList = new AlbumList();
public void insert() {
   String cd = JOptionPane.showInputDialog("Enter CD name:");
   if (cd!=null) {
     Album album = new Album(cd);
     myList.insert(album);
Album[] example = myList.getList();
}I then have my main application, this is how it looks at the moment:
import java.awt.*;
import java.awt.event.*;
import java.text.DecimalFormat;
import javax.swing.*;
import javax.swing.border.*;
import java.util.*;
import java.util.Timer;
import java.util.TimerTask;
import java.awt.event.KeyListener;
public class Assignment extends JFrame
     private JLabel MusicCdDatabaseJLabel;
     private JLabel AddEntryJLabel;
    private JButton AddEntryJButton;
    private JLabel SearchJLabel;
    private JButton SearchJButton;
    private JLabel SaveJLabel;
    private JButton SaveJButton;
    private JLabel LoadJLabel;
    private JButton LoadJButton;
public Assignment()
   createUserInterface();
private void createUserInterface()
          Container contentPane = getContentPane();
          contentPane.setLayout( null );
          MusicCdDatabaseJLabel = new JLabel();
          MusicCdDatabaseJLabel.setBounds( 80, 19, 435, 28 );
          MusicCdDatabaseJLabel.setText( "MUSIC CD DATABASE" );
          MusicCdDatabaseJLabel.setFont(new Font( "Default", Font.BOLD, 22 ) );
          MusicCdDatabaseJLabel.setHorizontalAlignment(JLabel.CENTER );
          contentPane.add( MusicCdDatabaseJLabel );
          AddEntryJButton = new JButton();
          AddEntryJButton.setBounds(16, 111, 170, 32 );
          AddEntryJButton.setText( "Add a new record" );
          AddEntryJButton.setFont(new Font( "Default", Font.BOLD, 16 ) );
          AddEntryJButton.setHorizontalAlignment(JLabel.CENTER );
          contentPane.add( AddEntryJButton );
          AddEntryJButton.addActionListener(
          new ActionListener() // anonymous inner class
            // event handler called when AddJButton is pressed
            public void actionPerformed( ActionEvent event )
               AddEntryJButtonActionPerformed( event );
         } // end anonymous inner class
      ); // end call to addActionListener
        SearchJButton = new JButton();
          SearchJButton.setBounds(16, 170, 170, 32 );
          SearchJButton.setText( "Search for a CD" );
          SearchJButton.setFont(new Font( "Default", Font.BOLD, 14 ) );
          SearchJButton.setHorizontalAlignment(JLabel.CENTER );
          contentPane.add( SearchJButton );
          SearchJButton.addActionListener(
          new ActionListener() // anonymous inner class
            // event handler called when searchJButton is pressed
            public void actionPerformed( ActionEvent event )
               SearchJButtonActionPerformed( event );
         } // end anonymous inner class
      ); // end call to addActionListener
        SaveJButton = new JButton();
          SaveJButton.setBounds(16, 229, 170, 32 );
          SaveJButton.setText( "Save current database" );
          SaveJButton.setFont(new Font( "Default", Font.BOLD, 14 ) );
          SaveJButton.setHorizontalAlignment(JLabel.CENTER );
          contentPane.add( SaveJButton );
          SaveJButton.addActionListener(
          new ActionListener() // anonymous inner class
            // event handler called when saveJButton is pressed
            public void actionPerformed( ActionEvent event )
               SaveJButtonActionPerformed( event );
         } // end anonymous inner class
      ); // end call to addActionListener
        LoadJButton = new JButton();
          LoadJButton.setBounds(16, 288, 170, 32 );
          LoadJButton.setText( "Load a database" );
          LoadJButton.setFont(new Font( "Default", Font.BOLD, 14 ) );
          LoadJButton.setHorizontalAlignment(JLabel.CENTER );
          contentPane.add( LoadJButton );
          LoadJButton.addActionListener(
          new ActionListener() // anonymous inner class
            // event handler called when LoadJButton is pressed
            public void actionPerformed( ActionEvent event )
               LoadJButtonActionPerformed( event );
         } // end anonymous inner class
      ); // end call to addActionListener
          setTitle( "MUSIC CD DATABASE" );
          setSize( 600, 700 );         
          setVisible( true );          
   } //end of create user interface
private void AddEntryJButtonActionPerformed( ActionEvent event )
    insert();
   } // end method AddEntryJTextFieldActionPerformed
private void SearchJButtonActionPerformed( ActionEvent event )
   } // end method SearchJButtonActionPerformed
private void SaveJButtonActionPerformed( ActionEvent event )
   } // end method SearchJButtonActionPerformed
private void LoadJButtonActionPerformed( ActionEvent event )
   } // end method SearchJButtonActionPerformed
public static void main( String[] args )
      Assignment application = new Assignment();
      application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
}The first two compile fine but the main application comes back with cannot find symbol method insert(). is this because this method is a void? I canr work out why it wont compile, everything else seems to be in place. Where am i going wrong? cheers

Kool, i have removed the instance from the albumList class and created my inset method in there. So i presume its the same with the Album[] getList() method. I still think i am not getting the proper meaning of how to do things correctly but this is what i am doing. this isnt being done in my main of my assignment class but under public class assigment, if that makes a difference. This is what i dont for the insert method and it works fine
public void insert() {
    String cd = JOptionPane.showInputDialog("Enter CD name:");
    if (cd!=null) {
     Album album = new Album(cd);
     myList.insert(album);
}This is what i have attempted for my Album[] getList() method.
Album[] data;
    public Album[] getList()
    for (int x=12; x>=0; x--) //for loop to check every object in all arrays
    System.out.println(data[x]);
    return data;
    }I dont know if i am on the right tracks all i know is that it doesnt work. What is really confusing me is all these names. In my full code at the top, is my array data, myList, myAlbum etc

Similar Messages

  • Passing methods to methods?

    I use to program in C++ once upon a time, and one of my favorite tricks was storing procedures in pointers so I could call procedures in parent classes from a sub class.
    Parent (say a scroll bar)
    updatePosition(int)
    child (one of the buttons)
    The child could call the updatePosition() procedure because I would pass it into the child class when I made it. It allowed me to make a button that could activate anything in my code, which was useful.
    Now I'm using Java and I wanted to do something similiar. I'm trying to make a graphical scroll bar (I plan on it's dimensions to change while it's in use, so it can't be an AWT or Swing scrollbar), and I've got some buttons made. I want to do this:
    MyScrollBar {
    int position = 0;
    void updatePosition(int amount) {
    position += amount;
    MyButton upbtn = new MyButton(updatePosition);
    MyButton downbtn = new MyButton(updatePosition);
    Just assume MyButton will respond to mouse clicks (it's workings doesn't matter really). When upbtn is clicked, I want it to be able to call the method in MyScrollBar that I passed into it when it was made. Short of making a MyButton that accepts a MyScrollBar passed to it, is there a way to call the procedure in it's parent?

    I ran into a similar problem, but I used a little trick. Make another class in that same .java file that your making which holds a static variable, where your main method sets up that JScrollbar, assigns it as a variable in that class, then other parts of your code access that JScrollBar through that class.
    class MyScrollBarHolder
      public static MyScrollBar msb;
      public static void setScrollBar(MyScrollBar msbTemp)
      {msb = msbTemp;}
      public void updatePosition()
      {//your code for handling that
    }this just goes at the end of your code. Then when a button wishes to access it, you just call MyScrollBarHolder.updatePosition() or you can get the ScrollBar itself with MyScrollBarHolder.msb
    Hope this helps
    Cheers

  • How to pass method name

    Could anyone please help. I want to pass a method's name to someother method, how can i pass the name of the method.
    say, I am in method1() and i want to pass its name that is method1 to another method method2(String str) , str would be method1's name. How can I do this.

    Could anyone please help. I want to pass a method's
    name to someother method, how can i pass the name of
    the method.
    say, I am in method1() and i want to pass its name
    that is method1 to another method method2(String str)
    , str would be method1's name. How can I do this.you would say method2("method1");

  • How to pass Method Inner Class reference to other method?

    Hi All,
    I am trying to pass the reference of "method inner class".
    Can any one explain me how to pass the reference and where other method will sit in the class, I mean either in Outer Class or in Inner Class ?
    Thanks in advance for ur reply :)
    package methosInnerClass;
    public class MethodLocalInnerClass {
         private String outerName;
         private static String statOuterName;
         public MethodLocalInnerClass(String name, String statName) {
              outerName = name;
              statOuterName = statName;
         public void methodWithLocallClass() {
              class MethodInnerClass {
                   String innerName;
                   MethodInnerClass(String name) {
                        innerName = name;
                   public void displayOuterInner() {
                        System.out.println("Outer Name: " + outerName + "\nOuter StatName: " + MethodLocalInnerClass.statOuterName + "\nInner Name: " + innerName);
              MethodInnerClass methodInner = new MethodInnerClass("Harish");
              methodInner.displayOuterInner();
                    *Pass above reference to other method*
         public static void staticMethodWithLocallClass() {
              class MethodInnerClass {
                   String innerName;
                   MethodInnerClass(String name) {
                        innerName = name;
                   public void displayOuterInner() {
                        // We can not access the non-static instance variable since this method is a static method
                        //System.out.println("Outer Name: " + outerName + "\nOuter StatName: " + MethodLocalInnerClass.statOuterName + "\nInner Name: " + innerName);
                        System.out.println("Outer StatName: " + MethodLocalInnerClass.statOuterName + "\nInner Name: " + innerName);
              new MethodInnerClass("Shakshi").displayOuterInner();
         public static void main(String[] args) {
              new MethodLocalInnerClass("Abhishek","Neeshu").methodWithLocallClass();
              System.out.println("Calling innerClass within static method !!!");
              staticMethodWithLocallClass();
    }

    package donald.test.inner_class;
    public class OutterClass {
         private String outerName;
         private final OutterClass outterClass;
         public OutterClass() {
              outterClass = this;
         public void methodWithInnerClass(final String strValueToPassToInnerClass) {
              class InnerClass {
                   private InnerClass innerClass;
                   private String innerName;
                   InnerClass(String name) {
                        innerName = name;
                   public void displayOuterInner() {
                        System.out.println("Non-Static:\tOuter Name: " + outerName + "\tInner Name: " + innerName);
                        System.out.println("");
                        System.out.println("final String strValueToPassToInnerClass = " + strValueToPassToInnerClass);
                    * @return the innerClass
                   public InnerClass getInnerClass() {
                        return innerClass;
                    * @param innerClass the innerClass to set
                   public void setInnerClass(InnerClass innerClass) {
                        this.innerClass = innerClass;
                    * @return the innerName
                   public String getInnerName() {
                        return innerName;
                    * @param innerName the innerName to set
                   public void setInnerName(String innerName) {
                        this.innerName = innerName;
              InnerClass methodInner = new InnerClass("Inner.Donald");
              methodInner.displayOuterInner();
              System.out.println("My OutterClass " + outterClass.getOuterName());
        // Unknown "MethodInnerClass "
         public void passReferenceOfInnerClassToOtherMethod(     ) {
          * @param args
         public static void main(String[] args) {
              OutterClass outterClass = new OutterClass();
              outterClass.setOuterName("Outter.Donald");
              outterClass.methodWithInnerClass("This Donald is so very cool...!!!  Yeah...!!!");
          * @return the outerName
         public String getOuterName() {
              return outerName;
          * @param outerName the outerName to set
         public void setOuterName(String outerName) {
              this.outerName = outerName;
          * @return the outterClass
         public OutterClass getOutterClass() {
              return outterClass;
    }

  • Passing Method to Mydeclarative Component

    dear All
    i can pass facets,Attributes to my Declartative component , but i failed to pass the methods.
    can any one help ?
    thanks

    Hi,
    did you read [url http://www.oracle.com/technetwork/developer-tools/adf/learnmore/index-101235.html]ADF Code Corner.
    *024.      How-to build a reusable toolbar with Oracle ADF Declarative Components*
    "In the Create JSF Declarative Component dialog, click on the Methods tab and enter the names or the parameters: each method relating to a navigation action. You should also define the signature of the method you plan on hooking up to these parameters. For an ADF Action binding (which is what the various Next, Previous actions are) the type is:
    javax.faces.event.ActionEvent"
    Edited by: Martin on 23.01.2011 20:13

  • Passing methods as methods arguments

    Hi,
    how can I pass a method to another method?
    I need something like this:
    public void methodA() {
    System.out.println("Hallo world");
    public void methodB( Method method ) {
    method();
    // or
    method.invoke();
    and in my app:
    methodB( methodA );
    ...of course the code below didn't work :-D
    Thanks.

    sorry, I didn't understood very well the 'inteface
    aproach'. Do you have some example code?If the name of the method to be called truly needs to be dynamic, then this won't work but if you just want different behaviors, then you could do something like this: public interface Doer {
        void doIt();
    public class Doer1 implements Doer {
        void doIt() {
            // do some stuff
    public class Doer2 implements Doer {
        void doIt() {
            // do some other stuff
    public class DoerDriver {
        public static void main(String[] args) {
            for (int ix = 0; ix < args.length; ix++) {
                try {
                    Class klass = Class.forName(args[ix]);
                    Doer doer = (Doer)klass.newInstance();
                    doStuff(doer);
                catch (Exception exc) {
                    System.out.println("Couldn't do " + args[ix]);
                    exc.printStackTrace();
         * This method only exists to follow your model of passing the "method"--i.e., they dynamic
         * bit--to another method. We could just call doer.doIt() right inside the loop in main.
        private static void doStuff(Doer doer) {
            doer.doIt();
    java DoerDriver Doer1 Doer2 Doer2 Doer1
    Whether this works for you depends on what you're really trying to do.

  • Passing variable in a method bean to JSP Page

    Hello Everyone,
    Can I Have a quick example of passing method variables from a java bean to a JSP page, (no forms involved)
    thanks

    Hello again,
    maybe I didn't explain my self correctly,
    I have a java program that read's from an external file. The program tokenizes the file (I use String Tokenizing). What I want is for the Tokenized string to display on a JSP page, How do I accomplish this?
    Below is a small fragment of my string Tokenizing program: Please I need help.
    package dev;
    import java.io.*;
    import java.util.*;
    public class RoundDetail2
    public static final String SUITS[] = {" ", "Clubs", "Hearts", "Spades", "Diamonds", "Joker", "FaceDown"};
    public static final String VALUES[] = {"Joker ","Ace", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"};
    public static final String SuitVALUES[] = {" ","1","2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14"};
    public RoundDetail2() throws FileNotFoundException
    DataInputStream inFile=
                 new DataInputStream(
                    new BufferedInputStream(
                   new FileInputStream("C:/apps/jakarta-tomcat-4.0.6/webapps/ROOT/WEB-INF/classes/dev/Data_452SY2.txt")));
              DataOutputStream outFile = new DataOutputStream(
                               new FileOutputStream("C:/apps/jakarta-tomcat-4.0.6/webapps/ROOT/dev/jsp/wager_history.jsp"));
              String readDetail_topLayer;
           try
                 while((readDetail_topLayer = inFile.readLine()) != null)
              StringTokenizer tokenizer_topLayer = new StringTokenizer(readDetail_topLayer,"\t");
                   while  (tokenizer_topLayer.hasMoreTokens())
                        String string_gameID = tokenizer_topLayer.nextToken();
                        String string_roundID = tokenizer_topLayer.nextToken();
                        String string_bet = tokenizer_topLayer.nextToken();
                        String string_win = tokenizer_topLayer.nextToken();     
                        String string_roundDetail = tokenizer_topLayer.nextToken();     
                        String string_date_time = tokenizer_topLayer.nextToken();
                        System.out.println ("test tab!" + string_gameID);

  • Method passing

    Hi I am new to passing methods and I am having some problems compiling a program. Any ideas on how to to solve the 20 errors I have?
    import javax.swing.JOptionPane;
    class MethodsHomework
         public static void main (String[]args)
              // define the correct combination
              int firstNo=3;
              int secondNo=7;
              int thirdNo =4;
              int num1=getInt(numb);
              int num2=getInt(numb);
              int num3=getInt(numb);
              int attempt=0; // counts number of attempts
              boolean success = false; // flag to indicate lock opened
              while ((attempt<3) && !success)
                   boolean  correct = true; //  flag set false when guess wrong
              System.exit(0);
         public static int getInt(int numb)
              // first number
              String first = JOptionPane.showInputDialog(null,"Enter First Number",
              "Combination Lock",JOptionPane.QUESTION_MESSAGE);
              numb = Integer.parseInt(first);
              // second number
              String second = JOptionPane.showInputDialog(null,"Enter Second Number",
             "Combination Lock",JOptionPane.QUESTION_MESSAGE);
              numb = Integer.parseInt(second);
              // third number     
              String third = JOptionPane.showInputDialog(null,"Enter Third Number",
              "Combination Lock",JOptionPane.QUESTION_MESSAGE);
              numb = Integer.parseInt(third);
         public static boolean checkNumber(int num1,int num2,int num3)
              if (num1 != firstNo)
                   correct = false;
              if (num2 != secondNo)
                   correct = false;
              if (num3 != thirdNo)
                   correct = false;
              return correct;          
         public static boolean outputResultOfGuess(String[]args)
              // result
              if (correct)
                   return correct;
              return correct;
         public static void outputMessage(String result)
              if (correct)
                   JOptionPane.showMessageDialog(null,"Lock Open",
                           "Combination Lock", JOptionPane.INFORMATION_MESSAGE);
                   success=true;
              else
                   JOptionPane.showMessageDialog(null,"Lock Not Open",
                 "Combination Lock", JOptionPane.INFORMATION_MESSAGE);
                 success=false;
              attempt++;
              // tidying up
              if ((attempt == 3) && (!success))
                   JOptionPane.showMessageDialog(null,"You have had 3 attempts","Combination Lock",
                   JOptionPane.INFORMATION_MESSAGE);
    }

    Thanks for your replies. I have now got rid of 11 errors. I now have 7 errors after changing my code. Here is the updated code:
    import javax.swing.JOptionPane;
    class MethodsHomework
         public static void main (String[]args)
              boolean correct=true;
              int num1=getInt();
              int num2=getInt();
              int num3=getInt();
         public static int getInt()
              // first number
              String numString = JOptionPane.showInputDialog(null,"Enter First Number",
              "Combination Lock",JOptionPane.QUESTION_MESSAGE);
              int numb = Integer.parseInt(numString);
         public static boolean checkNumber(int num1,int num2,int num3)
              // define the correct combination
              int firstNo=3;
              int secondNo=7;
              int thirdNo =4;
              if (num1 != firstNo)
                   correct = false;
              if (num2 != secondNo)
                   correct = false;
              if (num3 != thirdNo)
                   correct = false;
              return correct;          
         public static boolean outputResultOfGuess(boolean correct)
              // result
              if (correct)
                   return correct;
              return correct;
         public static void outputMessage(boolean correct)
              int attempt=0; // counts number of attempts
              if (correct)
                   JOptionPane.showMessageDialog(null,"Lock Open",
                           "Combination Lock", JOptionPane.INFORMATION_MESSAGE);
                   success=true;
              else
                   JOptionPane.showMessageDialog(null,"Lock Not Open",
                 "Combination Lock", JOptionPane.INFORMATION_MESSAGE);
                 success=false;
              attempt++;
              // tidying up
              if ((attempt == 3) && (!success))
                   JOptionPane.showMessageDialog(null,"You have had 3 attempts","Combination Lock",
                   JOptionPane.INFORMATION_MESSAGE);
    }Here is the error list:
    --------------------Configuration: JDK version 1.4.2 <Default>--------------------
    U:\Java\Week8\MethodsHomework\MethodsHomework.java:32: cannot resolve symbol
    symbol  : variable correct
    location: class MethodsHomework
                   correct = false;
                            ^
    U:\Java\Week8\MethodsHomework\MethodsHomework.java:35: cannot resolve symbol
    symbol  : variable correct
    location: class MethodsHomework
                   correct = false;
                            ^
    U:\Java\Week8\MethodsHomework\MethodsHomework.java:39: cannot resolve symbol
    symbol  : variable correct
    location: class MethodsHomework
                   correct = false;
                            ^
    U:\Java\Week8\MethodsHomework\MethodsHomework.java:40: cannot resolve symbol
    symbol  : variable correct
    location: class MethodsHomework
              return correct;          
                           ^
    U:\Java\Week8\MethodsHomework\MethodsHomework.java:63: cannot resolve symbol
    symbol  : variable success
    location: class MethodsHomework
                   success=true;
                            ^
    U:\Java\Week8\MethodsHomework\MethodsHomework.java:69: cannot resolve symbol
    symbol  : variable success
    location: class MethodsHomework
                 success=false;
                    ^
    U:\Java\Week8\MethodsHomework\MethodsHomework.java:75: cannot resolve symbol
    symbol  : variable success
    location: class MethodsHomework
              if ((attempt == 3) && (!success))
                                            ^
    7 errors
    Process completed.Thanks for your assistance,

  • Passing a method as parameter

    Hi!!
    How can I pass a method as parameter to other method? Is there any class that represents a methos like, for example, HelloWorld?
    Thanks everybody!!

    JosAH wrote:
    sweee wrote:
    How can I pass a method as parameter to other method? Is there any class that represents a methos like, for example, HelloWorld?Reflection can (sort of) do this; have a look at the API for the Method class but I prefer to define a couple of interfaces and stay far away from reflection.
    kind regards,
    Jos.. and the possibility to pass methods as arguments might also become true if we get closures in Java 7.

  • 7-pass, or zero out-Disk Utility Erase Free Space

    Hey Forum,
    I want to clear my erase free space on disk utility. And I am confused, whether to use 7-pass or zero-out? Any suggestions which one to use. Is zero out enough, or is 7-pass too much, any suggestions of whether to use either of them is appreciated, thank you.
    Ala.
    P.S. What are zero-out, 7-pass, and the 35 thing for and their differences?

    There is no need to post the same question twice, especially in the same forum.
    Regarding what you can find with Google, an overly simplified or out of date treatment of the topic may lead you to the wrong conclusions. For example, the DoD 5220-22M standard is obsolete (& never recommended a 7 pass erase to begin with) & the 35 pass erase was intended for old, pre-2001 drives.
    For modern ATA drives like you will find in any Mac capable of running Snow Leopard, one or at most a few zero data passes will do all any software-based secure erase method can do.
    If you need verification of that, refer to the Epilogue section of Secure Deletion of Data from Magnetic and Solid-State Memory, the seminal paper on the subject by the author of the 35 pass method.

  • How to pass more number of parameters in procedure

    How can we send 1000 parametrs in a procedure?
    is there any other method to pass parameters without defning 1000 parametrs
    Any example really helpful

    I know it's a hint, but have you ever known it to be ignored? Can you provide a working example showing it being ignored?Well it is not hard to demonstrate it being ignored, but these restrictions, while not obvious, are relatively well documented.
    What does not appear to be documented is the behaviour when calling from 3GLs (or does this qualify as an external procedure call?) where I believe the hint is also ignored.
    http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14261/tuning.htm#sthref2261
    "The use of NOCOPY increases the likelihood of parameter aliasing. For more information, see "Understanding Subprogram Parameter Aliasing".
    Remember, NOCOPY is a hint, not a directive. In the following cases, the PL/SQL compiler ignores the NOCOPY hint and uses the by-value parameter-passing method; no error is generated:
    1. The actual parameter is an element of an associative array. This restriction does not apply if the parameter is an entire associative array.
    2. The actual parameter is constrained, such as by scale or NOT NULL. This restriction does not apply to size-constrained character strings. This restriction does not extend to constrained elements or attributes of composite types.
    3. The actual and formal parameters are records, one or both records were declared using %ROWTYPE or %TYPE, and constraints on corresponding fields in the records differ.
    4. The actual and formal parameters are records, the actual parameter was declared (implicitly) as the index of a cursor FOR loop, and constraints on corresponding fields in the records differ.
    5. Passing the actual parameter requires an implicit datatype conversion.
    6. The subprogram is called through a database link or as an external procedure."
    For example, consider rule #2 above and compare output of first block (with unconstrained NUMBER datatype) with second (with constrained NUMBER datatype).
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    SQL> SET SERVEROUTPUT ON;
    SQL> <<anonymous_block>>
      2  DECLARE
      3     variable_name NUMBER := 0;
      4
      5     PROCEDURE procedure_name (
      6        parameter_name   IN OUT NOCOPY   NUMBER)
      7     IS
      8     BEGIN
      9        dbms_output.put_line ('#2 variable_name => ' || variable_name);
    10        parameter_name := parameter_name + 1;
    11        dbms_output.put_line ('#3 variable_name => ' || variable_name);
    12     END procedure_name;
    13  BEGIN
    14     dbms_output.put_line ('#1 variable_name => ' || variable_name);
    15     procedure_name (variable_name);
    16     dbms_output.put_line ('#4 variable_name => ' || variable_name);
    17  END anonymous_block;
    18  /
    #1 variable_name => 0
    #2 variable_name => 0
    #3 variable_name => 1
    #4 variable_name => 1
    PL/SQL procedure successfully completed.
    SQL> <<anonymous_block>>
      2  DECLARE
      3     variable_name NUMBER (10) := 0;
      4
      5     PROCEDURE procedure_name (
      6        parameter_name IN OUT NOCOPY NUMBER)
      7     IS
      8     BEGIN
      9        dbms_output.put_line ('#2 variable_name => ' || variable_name);
    10        parameter_name := parameter_name + 1;
    11        dbms_output.put_line ('#3 variable_name => ' || variable_name);
    12     END procedure_name;
    13  BEGIN
    14     dbms_output.put_line ('#1 variable_name => ' || variable_name);
    15     procedure_name (variable_name);
    16     dbms_output.put_line ('#4 variable_name => ' || variable_name);
    17  END anonymous_block;
    18  /
    #1 variable_name => 0
    #2 variable_name => 0
    #3 variable_name => 0
    #4 variable_name => 1
    PL/SQL procedure successfully completed.
    SQL>

  • Methods returning String

    Do Methods returning String create a String object in memeory and pass back the reference to the calling Method?
    Thanks

    hmm, i'll take a shot at answering your query - hope this meets your requirement ... Java does manipulate objects by reference, and all object variables are references. So when a method returns a String object (this object would be created within the scope of the method) the object reference is returned to the caller.
    Now the point of confusion usually happens since, Java doesn't pass method arguments by reference; it passes them by value. Java passes object references by value as well. What this means is the references passed to the method are actually copies of the original references.Java copies and passes the reference by value, not the object. Thus, method manipulations on the object reference will alter the objects, since the references point to the original objects. But since the references are copies, swaps will fail.
    Hope the above helps.
    John Morrison

  • Java method in my user interface

    how do i use my java method in my user interface i what this method to be used when i click the login button
    public void PerformSdmsLogon(String userid ,String pwd ) {
    callPerformSdmsLogon("SMS_FORM_TO_ADf.perform_sdms_logon(?,?)",
    new Object[]{userid,pwd,});
    }

    hi Tshifhiwa
    Tshifhiwa wrote:
    how do i use my java method in my user interface i what this method to be used when i click the login button ...You should really provide more information about what your are trying to do, your use-case, and also which version of JDeveloper you are using, which technoligy you are trying to use, which documentation (or examples) you are using.
    Without that you should not be expecting a useful answer to your question.
    (see also https://forums.oracle.com/forums/ann.jspa?annID=56 )
    (see also my reply at Re: how to pass method )
    regards
    Jan Vervecken

  • AS2 ... how to NOT capture an event, how to pass the event onwards through the event bubbling flow

    hello;
    I have:
    Class my_class
      { public function my_class( an_mc )
             an_mc.onUnload = function()
               { // this capture prevents other listeners from getting it also;
                 //  in Adobe Director's Lingo, there is a pass method.

    true;
    I have two requests for some_mc.onUnload, one of which is built into a flipbook 'component' that I am using, and the other one which I need;
    it seems that mine is preventing the flipbook component from receiving it's;
    so ideally I would like to 'pass' the event onwards to any other listeners ( ie the flipbook's );
    for now I am not including mine in order to allow the flipbbook to do what it needs, and using some hacky approach to realise that some_mc has been removed from the stage;

  • What is the most efficient way to pass LV data to a dll?

    For efficiency, this question primarily becomes important when passing large arrays, structures containing large arrays, or generally, any large block of data to a dll.
    The way the dll setup appears and the .c file it create for the dll call, it appears that labVIEW directly passes data in whatever native passing format LV requires without copying the actual data if you select the "Adapt to Type" as the "Type" option. If I pass an array, for example, the .c file contains the type definition of a labVIEW array, i.e., (size,data), and depending whether I select handle or handle pointer, the data passed is either a handle or handle pointer to the array. Likewise, if I pass a LV structure, the .c file will con
    tain the typedef to the structure and the data passed is either a pointer, or pointer to a pointer. These are, I believe, labVIEW native types and do not require copying.
    On the other hand if an array is passed as an array type, then it is converted to a C array that requires LV to copy the array on both sides of the call.
    I further assume all structures can be passed to the memory manager to be manipulated, although I'm actually not sure that you could resize an array pointer in the dll. That seems a bit dubious, but then I guess upon return LV could query the memory manager to determine the array pointer size.
    That�s how I would think things work. If not, could someone please correct me?
    Kind regards,
    Eric

    Eric,
    Let me tell you something about me too...
    I've been working with LabVIEW for (just) 4 years. That is, 40 hours a week
    professionally, 10 hours a week privatelly. I've started with LV4, and went
    through all versions and revisions until 6.0.2 (6.1 will come soon, but
    first I have to finish some major projects.
    During this time I've been working on lots of interfaces with the windows
    OS. Some 'dll' things I've worked on: OpenGL interface, MSXML driver,
    keyboard hooks, mouse hooks, GDI interfacing, calling LV dll's from
    assembler, calling assembler dll's from LV, creating threads, using serial
    interrupts, etc. I'm now (also) working on a way to automatically generate
    documentation (much more then the 'export VI stings') from a VI. This
    requires 'under the hood' knowledge about how VI's work.
    When I had to make a fast routine for a project one time, I choose
    assembler, because I had this knowledge. Also, I wanted to use pure SIMD
    opperations. The operation had to modify an array of DBL's. The SIMD uses
    the same format (IEEE 754, I think), so it was easy. But when it came to
    testing, it appeard that the routine only paid off if the routine was 'long'
    enough. The routine was n*O^2, where n was a parameter. When the array was
    large, and n small, the overhead of copiing the array to modifiable memory
    was relativelly large, and the LV routine was faster.
    When I get a pointer to a LV array, I can use this pointer to modify the
    data in the array. This can (I think) only be done if LV copied this data,
    just like LV is doing when a wire is split to be modified.
    It might be that this copiing can be prevented, e.g. by using other data
    types, or fiddling with threads and reentrance... If you want to optimally
    benefit from dll's I'd look for a way to keep the data in the dll space, or
    pass it once at initialisation. You could use CreateHeap, HeapAlloc,
    AllocGlobal, and other functions. You can use these functions in LV, or in
    the dll. Once you have a pointer to the (one and only) data space, you can
    use this to pass to the dll functions.
    I think LV does not show the memory in question in the profiler, but I'm not
    sure.
    Using the "Adapt to type" option might just result in a internal convertion
    during 'compile' time, and might be exactly the same as doing it yourself.
    Perhaps you can share a bit about the application you are making, or at
    least why you need the speed you are seeking?
    Regards,
    Wiebe.
    "Eric6756" wrote in message
    news:50650000000500000025C60000-1042324653000@exch​ange.ni.com...
    Greg,
    There are two relevant documents which are distributed with labVIEW,
    in labVIEW 6i, (hey, I'll get around to upgrading), the first is
    titled, "Using External Code in LabVIEW", the second is application
    note 154, "LabVIEW Data Formats".
    Actually, a statement Wiebe@air made on my previous question regarding
    dll calls, "Do dll calls monopolize the calling thead?" provoked this
    line of questions. Based on other things he has said, I gather he is
    also using dlls. So as long as we're here let me ask the next
    question...
    If labVIEW must make a copy of the passed data, does it show up as
    additional memory blocks in the vi profiler? In other words, can you
    use the profiler to infer what labVIEW is doing, or as you put it,
    infer whether there is a clever passing method available?
    As a personal note Greg:
    First, as a one time engineering student and teaching assistant, I
    don't recall hearing or using the terms "magical", or "clever". Nor I
    might add, do I find them in print elsewhere in technical journals.
    While I don't mind NI marketing in their marketing documents, used
    here in this mostly educational forum, they strike me as arrogant,
    and/or pompous.
    I like NI's products because they work and are reliable. I doubt it
    has anything to do with magic, has somewhat more to do with being
    clever, but is mostly due to the dogmatic persistence of your
    engineers. I rather doubt any of them adjoin the term "magical" or
    even "clever" to their solutions. I believe the term "best" is
    generally accepted with the qualifier "I've or we've found". At
    least, that has been my engineering experience.
    Second, many of my questions I can sort out on my own, but I figure as
    long as your willing to answer the questions, then your answers are
    generally available to others. The problem is that one question seems
    to lead to another and specific information gets buried in a rather
    lengthy discourse. When I come here with a specific question, it
    would be nice to find it asked and answered specifically rather than
    buried in the obscurity of some other question. As such, at some
    point in these discussions it might be appropriate to reframe a
    question and put at the top. In my opinion, that decision is
    primarily yours as you have a better feel for the redundancy of
    questions asked and/or your answers.
    Anyway, the next question I'm posting at the top is, "Do the handles
    passed to a dll have to be locked down to insure other threads don't
    move the data?"
    Thanks,
    Kind Regards,
    Eric

Maybe you are looking for