2 Replies - 2821 Views - Last Post: 13 November 2009 - 03:14 PM Rate Topic: -----

#1 rimaganguly  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 05-November 09

how to use package in textpad

Posted 13 November 2009 - 11:58 AM

i have defined 3 classes called "base","derived" and "other" in a package called "p1".I have also made a directory called p1 in the path d:/javap/p1 and incuded all the 3 classes which i want 2 put in the package.then i have made a class called "p1demo.java" where main function resides and also put in the same package.
this is base.java
package d.javap.p1;
class base
{

	int n=1;
	private int pri_n=2;
	protected int pro_n=3;
	public int pub_n=4;

	base()
	{
		System.out.println("value of n is="+" "+n);
		System.out.println("value of pri_n is="+" "+pri_n);
		System.out.println("value of pro_n is="+" "+pro_n);
		System.out.println("value of pub_n is="+" "+pub_n);
	}
}


derived.java
package d.javap.p1;
class derived extends base
{


	derived()
	{
		System.out.println("value of n is="+" "+n);
		System.out.println("value of pri_n is="+" "+pri_n);
		System.out.println("value of pro_n is="+" "+pro_n);
		System.out.println("value of pub_n is="+" "+pub_n);
	}
}




other.java
package d.javap.p1;
class other
{


	other()
	{
		System.out.println("value of n is="+" "+n);
		System.out.println("value of pri_n is="+" "+pri_n);
		System.out.println("value of pro_n is="+" "+pro_n);
		System.out.println("value of pub_n is="+" "+pub_n);
	}
}



p1demo.java
package d.javap.p1;
public class p1demo
{
	public static void main(String args[])
	{
		base b=new base();
		derived d=new derived();
		other o=new other();
	}
}






i m using textpad.
when i am trying to compile p1demo.java it shows errors saying "cannot find symbo base,derived,other"


anybody can please help me

*Edited: code tags fixed

This post has been edited by pbl: 13 November 2009 - 03:12 PM


Is This A Good Question/Topic? 0
  • +

Replies To: how to use package in textpad

#2 Ice(ITB)  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 48
  • Joined: 19-August 09

Re: how to use package in textpad

Posted 13 November 2009 - 02:49 PM

[ code] your code here ..... helps everyone read it [ /code]

with no spaces in the [squarebrackets]

This post has been edited by Ice(ITB): 13 November 2009 - 02:52 PM

Was This Post Helpful? 0
  • +
  • -

#3 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8334
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: how to use package in textpad

Posted 13 November 2009 - 03:14 PM

First the drive is not include in your package

so your package name should be:

javap.p1 if you compile from d:/
p1 if you compile from d:/japap
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1