File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes User Defined Package Doubts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "User Defined Package Doubts" Watch "User Defined Package Doubts" New topic
Author

User Defined Package Doubts

Viji be
Greenhorn

Joined: Aug 16, 2004
Posts: 23
Hello All

Iam trying to create a user defined package MyPack
Iam encountering a problem :

MyOperation m=new MyOperation(); --- Cannot resolve symbol..
plz go thru the codes and tell me how to solve the errors...

MyOperations.java

package MyPack;

public class MyOperation
{
public int add(int a, int b)
{
int c;
c=a+b;
return c;
}
public int sub(int d,int e)
{
int f;
f=d-e;
return f;
}
public int mul(int g,int h)
{
int i;
i=g*h;
return i;
}
public int div(int j,int k)
{
int l;
l=j/k;
return l;
}
}

MyCalculation.java

import MyPack.*;

public class MyCalculation
{
public static void main(String args[])
{
int n1,n2,n3,n4;
MyOperation m=new MyOperation( );
n1=m.add(50,5);
n2=m.sub(40,5);
n3=m.mul(7,8);
n4=m.div(10,10);
System.out.println("The Value of n1 is"+n1);
System.out.println("The Value of n2 is"+n2);
System.out.println("The Value of n3 is"+n3);
System.out.println("The Value of n4 is"+n4);
}
}



I have compiled "MyOperations.java"...problems is in "MyCalculation.java".


Viji
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
i trie this:

before, i created two folders inside my root(raiz, in my case), called MyMain (this one will contain MyCalculation) and MyPack
to MyCalculation i made:



java amateur
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: User Defined Package Doubts