How do I call these methods?
This is an incomplete program so far but for some reason where I write the statement to call the method its an error (Quartersa(); [Quartersa(double) in addcoins.AddCoins cannot be applied ( )]). What is it that I'm doing wrong? The error is at the bottom of the code.
Heres what ive been working on:
package addcoins;
import java.util.Scanner;
* @author HP_Owner
public class AddCoins {
/** Creates a new instance of AddCoins */
public static void Quartersa(double quarters){
quarters = .25;
int quarteramount;
System.out.println("Qaurters:");
Scanner input = new Scanner(System.in);
quarteramount = input.nextInt();
quarters = quarteramount * 025;
System.out.print( quarters);
public static void Dimesa(double dimes){
dimes = .10;
int dimeamount;
System.out.println("Dimes:");
Scanner input = new Scanner(System.in);
dimeamount = input.nextInt();
dimes= dimeamount * .10;
System.out.print( dimes);
public static void Nickelsa(double nickels){
nickels = 0.5;
int nickelamount;
System.out.println("Nickels:");
Scanner input = new Scanner(System.in);
nickelamount = input.nextInt();
nickels = nickelamount * 0.5;
System.out.print( nickels);
public static void Penniesa(double pennies){
pennies = 0.1;
int pennyamount;
System.out.println("Pennies:");
Scanner input = new Scanner(System.in);
pennyamount = input.nextInt();
pennies = pennyamount * 0.1;
System.out.print( pennies);
public AddCoins() {
* @param args the command line arguments
public static void main(String[] args) {
// TODO code application logic here
Scanner input = new Scanner(System.in);
System.out.println("Enter your total coins:");
Quartersa(); //ERROR HERE
Edited by: tetris on Feb 2, 2008 10:03 PM
I think this is the problem
System.out.println("Enter your total coins:");
Quartersa(); //ERROR HERE
you would need to put something inside the parenthesis here Quartersa();
something like this might work...
System.out.println("Enter your total coins:");
int num=input.nextInt();
Quartersa(num);
good luck i hope it works.
Similar Messages
-
How Can I Call a method in iView ,which is in another iView
I Have 2 iViews i want to call a method in Iview which is i another iView
Thanks and Regards
Prasad.YHi Prasad,
first, welcom at SDN.
Next, let us clarify some wording:
A <i>PAR</i> is a <i>Portal ARchive</i>. It is a zip in a certain format. It contains a <i>portal application</i>.
A <i>portal application</i> consists of <i>components</i> and/or <i>services</i>.
An <i>iView</i> is somehow an "instance" of a <i>component</i>. It is created within the portal. There are <i>no iViews in a PAR</i> (like: "There are no objects in a JAR (but classes).").
With this in mind, you know that the question does not work, for iViews don't have "methods".
If you ask how you can call a method of a class belonging to a different component (but within the same portal app), it is no problem at all, each class has access to each other class within the same portal app (in fact, one has to differentiate between public and private part, but we don't want to go so far). To call use a class belonging to (the public part of) a different app, you will have to set the SharingReference within portalapp.xml.
If that's what you're looking for - great.
If not, ask again, but far more detailed.
Hope it helps
Detlev
PS: Please consider to reward points for helpful answers. Thanks in advance. -
How can I call a Method in a Transformation Routine
Hello Experts,
How can I call a Method in a Transformation Routine ??
THNXXHi,
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/6090a621-c170-2910-c1ab-d9203321ee19?quicklink=index&overridelayout=true
It will be help full .
Regards, -
How can we call the method of used controller?
Hi All,
i created two WDA Applications.( like YWDA1,YWDA2 ) . i am using the component WDA2 in WDA 1.and displaying the one view of WDA2 as popup window in WDA1 on action of one of the input element in the view of WDA1 by using the method l_window_manager->create_window_for_cmp_usage
I have a button on the view of WDA2 which has appear in the popup window...how can i call the method which has binded to that button....and where should i code that...and i need to assign selected value in the popup window to input elemetn of view WDA1
Please help me to resolve this....
Regards,
RaviYou can not directly call view's event handler from other component.
create a method in component controller of the second component and in the button click call the component controller method. ( also make the method as interface so that you can call it from other components )
Now, you can call the interfacecontroller's method
DATA: l_ref_INTERFACECONTROLLER TYPE REF TO ZIWCI__VSTX_REBATE_REQ_WD .
l_ref_INTERFACECONTROLLER = wd_This->wd_CpIfc_<comp usage name>( ).
l_ref_INTERFACECONTROLLER->Save_Rr(
STATUS = '01' " Zvstxrrstatus
save_rr is the method of second component controller -
How do you call a method from another class without extending as a parent?
How do you call a method from another class without extending it as a parent? Is this possible?
Why don't you just create an instance of the class?
Car c = new Car();
c.drive("fast");The drive method is in the car class, but as long as the method is public, you can use it anywhere.
Is that what you were asking or am I totally misunderstanding your question?
Jen -
EL - How do you call a method that requires a parameter
How do you call a method that requires a parameter
In scriplet code here is what I am trying to do
<%= car.getDefaultColor(car.getCarType()) %>
How do I do this in EL
Here is my guess (it generates the Exception described below)
${car.defaultColor(car.carType)}
Here is the Exception I am getting:
javax.servlet.ServletException: <h3>Validation error messages from tag library c</h3>tag = 'out' / attribute = 'value': An error occurred while parsing custom action attribute "value" with value "${car.defaultColor(car.carType)}": Encountered "(", expected one of ["}", ".", ">", "gt", "<", "lt", "==", "eq", "<=", "le", ">=", "ge", "!=", "ne", "[", "+", "-", "*", "/", "div", "%", "mod", "and", "&&", "or", "||"]
Any Ideas?
P.S. If it matters to you, I am using JSTL 1.0 and the code snippets above are actually within the value attribute of a <c:out value="" /> statement.How do you call a method that requires a parameter
In scriplet code here is what I am trying to do
<%= car.getDefaultColor(car.getCarType()) %>
How do I do this in ELYou don't. EL is very strict in method signatures. All get methods must be public Type getProperty(void); And all set methods must be public void setProperty(Type t);
So you will have to re-work your Bean so it does not need an argument to the get method (getDefaultColor()). Since you are calling another method out of car, you might re-write the getDefaultColor method as such:
public Object getDefaultColor() {
CarType ct = this.getCarType();
//then do other stuff
}If that isn't suitable, then provide a helper method that is used to set the current car type and then call the getDefaultColor:
private CarType curCarType;
public void setCurrentCarType(CarType ct) { curCarType = ct; }
public Object getDefaultColor() {
if (curCarType == null) throw new IllegalStateException("CarType must be set before getting color");
//normal work using curCarType
<c:set target="${car}" property="currentCarType" value="${car.carType}"/>
<c:out value="${car.defaultColor}"/>It is better to do as little of the data manipulation (setting up the car type) in the JSP as possible, so the first option is better than the second. Also better then the second would be to set the current car type in a servlet or data access object (or wherever) from which your retreive the car to begin with. Manipulatig it in the JSP itself should be your last resort (to keep as much business logic out of the JSP as possible).
Here is my guess (it generates the Exception
described below)
${car.defaultColor(car.carType)}
Here is the Exception I am getting:
javax.servlet.ServletException: <h3>Validation error
messages from tag library c</h3>tag = 'out' /
attribute = 'value': An error occurred while parsing
custom action attribute "value" with value
"${car.defaultColor(car.carType)}": Encountered "(",
expected one of ["}", ".", ">", "gt", "<", "lt",
"==", "eq", "<=", "le", ">=", "ge", "!=", "ne", "[",
"+", "-", "*", "/", "div", "%", "mod", "and", "&&",
"or", "||"]
Any Ideas?
P.S. If it matters to you, I am using JSTL 1.0 and
the code snippets above are actually within the value
attribute of a <c:out value="" /> statement. -
How would I call a method inside a dll?
How would I call a method inside a dll? Is it even possible in Java? Like in VB you would do something like this: XXX.dll --> XXX.Activate()... I have already loaded the dll like this:
String xxx = "C:/WINDOWS/system32/xxx.dll";
System.load(xxx);
Please help?
THXI've got another question.
I've gone through the link you posted and a couple others that I found.
I am able to create an interface using the windows kernel32.dll and go through an example I found.
But when I try to use a dll that I have from another application, I have problems.
Here is what I have for the interface.
public interface IAiCamDeviceControl extends StdCallLibrary {
public IAiCamDeviceControl INSTANCE=(IAiCamDeviceControl)Native.loadLibrary("D:\\IAiCamDeviceControl.dll",IAiCamDeviceControl.class);
// public long GetVersion( String s );
// public long Close();
}The interface that works looks like this:
public interface Kernel32 extends StdCallLibrary {
public Kernel32 INSTANCE=(Kernel32)Native.loadLibrary("Kernel32",Kernel32.class);I thought that the problem might be using the path name for the library, so I copied it into the system32 directory.
Still get the same error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'D:\IAiCamDeviceControl.dll': The specified module could not be found.
My main looks like
public class Main {
public static void main(String[] args) {
// Kernel32 lib=Kernel32.INSTANCE;
// Kernel32.SYSTEM_POWER_STATUS batteryStatus=new Kernel32.SYSTEM_POWER_STATUS();
// lib.GetSystemPowerStatus(batteryStatus);
// System.out.println(batteryStatus);
IAiCamDeviceControl camDev = IAiCamDeviceControl.INSTANCE;
}The commented part is from the version that worked.
All I attempted to do here was just create an instance of the interface.
Any idea why I can't access the dll?
The dll is the same one that is used successfully in VB, C#, and C++ demo programs, so I suspect it is a good dll. -
How can I call a method for all instances of a certain class?
Hi,
I have created a snake java applet, which you can play here [http://users.telenet.be/javagames/|http://users.telenet.be/javagames/].
But now I want to make this into a multi-player game (with two or more snakes etc..).
In my main class you can find methods like these:
snake.move();
snake.drawSnake();Now if I just alter my main class and make a second instance of the class snake and change my methods to this,
snake.move();
snake2.move();
snake.drawSnake();
snake2.drawSnake();my game almost works perfectly, I'll have to make some minor changes though.
But my question is, is there a better way of doing this. Instead of duplicating all the code, how can I make the methods immediately work for both snakes, instead of calling it twice?
All suggestions are welcome!
Thanks in advance.
LennartIf there was something common to all snake instances then you could declare that variable static.
Note: I don't want to confuse you here. A static variable can have a value apart from any instances at all. Instances can view static variables but a static method or inner class, for example, cannot view instance variables.
More generally, I would think you would want to treat each snake as an automaton with its own behavior. There must be some class such as Game or Board or whatever that has, as suggested, either an array or collection of snakes. Iterate over each snake, ask it to perform some computation for the game and then draw itself.
- Saish -
How we can call java methods in ODI?
Hi
i have java jars.i would like to call java methods from ODI
how it is possible in ODI?
plz help me regards the same
thanksHi
i tried according to given contents in this link
but in my systen i am getting error
could y plz help me regards solving this error
error is :
org.apache.bsf.BSFException: exception from Jython:
Traceback (innermost last):
File "<string>", line 1, in ?
java.lang.UnsupportedClassVersionError: FileWrite (Unsupported major.minor version 50.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.python.core.SyspathJavaLoader.loadClass(SyspathJavaLoader.java)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.python.core.Py.findClassEx(Py.java)
at org.python.core.SysPackageManager.findClass(SysPackageManager.java)
at org.python.core.PackageManager.findClass(PackageManager.java)
at org.python.core.SysPackageManager.findClass(SysPackageManager.java)
at org.python.core.PyJavaPackage.__findattr__(PyJavaPackage.java)
at org.python.core.PackageManager.lookupName(PackageManager.java)
at org.python.core.imp.load(imp.java)
at org.python.core.imp.import_next(imp.java)
at org.python.core.imp.import_name(imp.java)
at org.python.core.imp.importName(imp.java)
at org.python.core.ImportFunction.load(__builtin__.java)
at org.python.core.ImportFunction.__call__(__builtin__.java)
at org.python.core.PyObject.__call__(PyObject.java)
at org.python.core.__builtin__.__import__(__builtin__.java)
at org.python.core.imp.importOne(imp.java)
at org.python.pycode._pyx0.f$0(<string>:1)
at org.python.pycode._pyx0.call_function(<string>)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyCode.call(PyCode.java)
at org.python.core.Py.runCode(Py.java)
at org.python.core.Py.exec(Py.java)
at org.python.util.PythonInterpreter.exec(PythonInterpreter.java)
at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:144)
at com.sunopsis.dwg.codeinterpretor.k.a(k.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSqlS.treatTaskTrt(SnpSessTaskSqlS.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
at com.sunopsis.dwg.cmd.e.i(e.java)
at com.sunopsis.dwg.cmd.g.y(g.java)
at com.sunopsis.dwg.cmd.e.run(e.java)
at java.lang.Thread.run(Unknown Source)
java.lang.UnsupportedClassVersionError: java.lang.UnsupportedClassVersionError: FileWrite (Unsupported major.minor version 50.0)
at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:146)
at com.sunopsis.dwg.codeinterpretor.k.a(k.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSqlS.treatTaskTrt(SnpSessTaskSqlS.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
at com.sunopsis.dwg.cmd.e.i(e.java)
at com.sunopsis.dwg.cmd.g.y(g.java)
at com.sunopsis.dwg.cmd.e.run(e.java)
at java.lang.Thread.run(Unknown Source) -
How do i call these functions without an error? Python
Hi, I'm confused on how to call these functions I'm continuously getting error can you please help me.
I am also unsure on how parameters work and don't know what I need to write in them, i'm a bit of noob so will need you to explain thoroughly thank you
I am trying to get a dice roll and then the player chooses which counter to move, the program will then automatically minus the movement from the counters position
counter = ()
postiony_red1 = 605
postiony_red2 = 605
def dice_roll():
import random
dice = random.randint(1, 4)
print("You rolled a", dice)
if dice == 1 :
print("You can step forward", dice, "move")
elif dice == 2 or dice == 3:
print("You can move", dice, "steps forward")
else:
print("You can move 1 space back")
input("Press return")
return dice
def move(dice):
if dice == 1:
move = -60
elif dice == 2:
move = -120
elif dice == 3:
move = -180
elif dice == 4:
move = 60
print("move")
return move
def ask_player():
while counter != ("counter 1") or ("counter 2"):
counter = input("Do you wish to move counter 1 or counter 2?")
return counter
def counter_postion():
if counter == ("counter 1"):
move += postiony_red1
print("total move is", move)
elif counter == ("counter 2"):
move += postiony_red2
print("total move is", move)
dice_roll()This forum section here is about Small Basic programing language!
I dunno Python, but the few droplets I've heard about is that Python is very strict about global variables!
And that every time we need to assign values to them, we gotta declare it w/
global keyword inside each function that needs it:
def ask_player():
global counter
while counter != "counter 1" or "counter 2":
counter = input("Do you wish to move counter 1 or counter 2?")
return counter
Click on "Propose As Answer" if some post solves your problem or "Vote As Helpful" if some post has been useful to you! (^_^) -
How do I call a method of an instance of an interface?
I create an instance of a class that implements the Uncmin_methods interface:
Uncmin_methods optFunctions = ( Uncmin_methods ) new Optimizer( epsilon );
Then I want to do something like:
optFunctions.setDesiredProbRow( desiredProbRow );
But the stupid compiler won't let me call one of Optimizer's methods.
Is optFunctions a Uncmin_method object or an Optimizer object?
How could I update the optFunctions object with some dynamic data?But the stupid compiler won't let me call one of
Optimizer's methods.The compiler isn't "stupid". It knows the rules of the Java language better than you or I do. If it won't compile, better figure out why. I can't tell you, because "Optimizer" and "Uncmin_method" are presumably your own home-made interfaces/classes which I wouldn't know about.
Is optFunctions a Uncmin_method object or an
Optimizer object?See last sentence above. -
How do I call a method when the user clicks on the delete button?
Hello , I need to implement the following :
If date from is less than sysdate , when the user clicks the "delete" button , he is shown an error message .
Can you please help how this can be done ? Thanks.Thanks. What are the steps for adding a custom delete button ?
Are these ok ?
1 ) Add an adf button
2) Add the following in the actions listener : #{bindings.Delete.execute}
3) Right Click button --> create method binding for action
4) Compare date ?
Thanks. -
How do i call the method in a class using servlet
i am doing a project which need to use servlet to call a few methods in a class and display those method on the broswer. i tried to write the servlet myself but there are still some errors .. can anyone help:
The servlet i wrote :
package qm.minipas;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class test extends HttpServlet {
Database database;
/** Initializes the servlet.
public void init(ServletConfig config) throws ServletException {
super.init(config);
database = FlatfileDatabase.getInstance();
/** Destroys the servlet.
public void destroy() {
/** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* @param request servlet request
* @param response servlet response
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException {
response.setContentType("text/html");
java.io.PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet</title>");
out.println("</head>");
out.println("<body>");
out.println("this is my class wossname"+FlatfileDatabase.getInstance()); // this is calling the toString() method in the instance of myJavaClass
out.println("this is my method"+FlatfileDatabase.getAll());
out.println("</body>");
out.println("</html>");
out.close();
/** Handles the HTTP <code>GET</code> method.
* @param request servlet request
* @param response servlet response
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException {
processRequest(request, response);
/** Handles the HTTP <code>POST</code> method.
* @param request servlet request
* @param response servlet response
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException {
processRequest(request, response);
/** Returns a short description of the servlet.
public String getServletInfo() {
return "Short description";
my methods which i need to call are shown below:
public Collection getAll() {
return Collections.unmodifiableCollection(patientRecords);
public Collection getInpatients() {
Collection selection=new ArrayList();
synchronized(patientRecords) {
for(Iterator i=patientRecords.iterator(); i.hasNext();) {
PatientRecord next=(PatientRecord) i.next();
if(next.isInpatient())
selection.add(next);
return Collections.unmodifiableCollection(selection);
public Collection getByAdmissionDate(Date dateOfAdmission) {
List selection=new ArrayList();
for(Iterator i=patientRecords.iterator(); i.hasNext();) {
PatientRecord next=(PatientRecord) i.next();
if(dateOfAdmission.equals(next.getDateOfAdmission()))
selection.add(next);
return Collections.unmodifiableCollection(selection);
public Collection getByAdmissionDates(Date from,Date to)
throws IllegalArgumentException {
if(to.before(from))
throw new IllegalArgumentException("End date must not be before start date");
List selection=new ArrayList();
for(Iterator i=patientRecords.iterator(); i.hasNext();) {
PatientRecord next=(PatientRecord) i.next();
Date nextAD=next.getDateOfAdmission();
if((nextAD.after(from)||nextAD.equals(from))
&&(nextAD.before(to)||nextAD.equals(to)))
selection.add(next);
return Collections.unmodifiableCollection(selection);
public Collection getByDischargeDates(Date from,Date to)
throws IllegalArgumentException {
if(to.before(from))
throw new IllegalArgumentException("End date must not be before start date");
List selection=new ArrayList();
for(Iterator i=patientRecords.iterator(); i.hasNext();) {
PatientRecord next=(PatientRecord) i.next();
Date nextAD=next.getDateOfDischarge();
if(nextAD==null)
continue;
if((nextAD.after(from)||nextAD.equals(from))
&&(nextAD.before(to)||nextAD.equals(to)))
selection.add(next);
return Collections.unmodifiableCollection(selection);
public Collection getByConsultant(String consultant) {
List selection=new ArrayList();
for(Iterator i=patientRecords.iterator(); i.hasNext();) {
PatientRecord next=(PatientRecord) i.next();
if(consultant.equalsIgnoreCase(next.getConsultant()))
selection.add(next);
return Collections.unmodifiableCollection(selection);
public Collection getByDischargeDate(Date dateOfDischarge) {
List selection=new ArrayList();
for(Iterator i=patientRecords.iterator(); i.hasNext();) {
PatientRecord next=(PatientRecord) i.next();
if(dateOfDischarge.equals(next.getDateOfDischarge()))
selection.add(next);
return Collections.unmodifiableCollection(selection);
public Collection getBySurname(String surname) {
List selection=new ArrayList();
for(Iterator i=patientRecords.iterator(); i.hasNext();) {
PatientRecord next=(PatientRecord) i.next();
if(surname.equalsIgnoreCase(next.getSurname()))
selection.add(next);
return Collections.unmodifiableCollection(selection);
public Collection getByWard(String ward) {
List selection=new ArrayList();
for(Iterator i=patientRecords.iterator(); i.hasNext();) {
PatientRecord next=(PatientRecord) i.next();
if(ward.equalsIgnoreCase(next.getWard()))
selection.add(next);
return Collections.unmodifiableCollection(selection);please provide a detail description of your errors.
-
How Can I Call the method in WAR project's class?
Message was edited by: JUNHA SHIN
I have one correct Web Moudule Project.
The EAR project(EmployeeCardJdoEar) added the WAR archive
(EmployeeCardJdoWar) is run correctly.
I want to add the war archive to my WD project.
because, the war project contain business logic to be reused.
so. i had enrolled in my WD project's properties ->
Web Dynpro References -> Sharing References ->
sap.com/EmployeeCardJdoEar.
but, this method in WAR(EmployeeCardJdoWar) occurs Exception.
Context ctx = new InitialContext();
pmf = (PersistenceManagerFactory)
ctx.lookup("java:comp/env/jdo/defaultPMF");
I think lookup call is not run correctly.
But, this lookup is run correctly in my EAR project. -
How can I call a method of an object that is stored in an ArrayList?
Hello,
I am working on a simple game.
I have my own collection class that can contain some Brick objects.
That class looks like this:
class MyCollection<Brick>
ArrayList<Brick> list = new ArrayList<Brick>();
public void add(Brick obj)
list.add(obj);
public int get(int i)
return list.get(i);
public int length()
return list.size();
}My Brick class is abstract and contains this method:
public abstract int getXpos();That method is overridden by the subclass Brick_type1 (which, of course, extends Brick) and returns an int.
In my main class I try to call the getXpos() method but I cannot call if for an unknown reason:
MyCollection mc = new MyCollection<Brick>();
Brick_type1 bt = new Brick_type1(10);
mc.add(bt);
for(int i = 0; i<mc.length(); i++)
System.out.println(bc.get(i).getXpos()); // getXpos() does not exist, says the compilatorbc.get(i) should return a Brick that contains the getXpos() method, so why can´t I call it?Roxxor wrote:
Sorry, it should be:
public Brick get(int i)
return list.get(i);
}...so it actually returns a Brick, but I still cannot call the getXpos() method for some reason.Is this also just a typo?
MyCollection mc = new MyCollection<Brick>();
Maybe you are looking for
-
Selecting a single column in SQL
Hi all, I am doign a Java application at the moment and I need to select only a single column in a row of a table. I know that I can do something like SELECT column_name FROM table but the fact is, I am not supposed to know the name of the column, bu
-
Trouble printing multiple pages with HP ENVY 5531
I am printing wirelessly from a Windows 8 machine. If I only print one page it works fine every time. If I try to print multiple pages then on the 2nd or 3rd page it always cuts off the bottom portion of the page. There was another post that had a
-
I am trying to locate the 'Audio Tools Menu' in Premier elements 9.
I want to add a narration using Premier Elements 9. I am told to choose "Add Narration" from the "Audio Tools Menu", but have been unable to locate anything like that. Just how is that done?
-
While restoring my iPhone 3G, i kept getting this error message 2003, What should I do?
-
I have just loaded the up todate firefox, and whn i try and open hotmail sign in page, all i get is a white blank page. can any1 help me