• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

User Defined Package Doubts

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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".
 
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:

 
Just the other day, I was thinking ... about this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic