Welcome to Dream.In.Code
Become a Java Expert!

Join 150,065 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,777 people online right now. Registration is fast and FREE... Join Now!




how to call/access package

 
Reply to this topicStart new topic

how to call/access package

kumar.dinesh1984
12 Jun, 2008 - 07:23 PM
Post #1

New D.I.C Head
*

Joined: 12 Jun, 2008
Posts: 3

what is package?
how to call/access package?
how to access public class in other package?????
plz help me.....................
User is offlineProfile CardPM
+Quote Post

pbl
RE: How To Call/access Package
12 Jun, 2008 - 07:27 PM
Post #2

D.I.C Lover
Group Icon

Joined: 6 Mar, 2008
Posts: 3,587



Thanked: 233 times
Dream Kudos: 75
My Contributions
QUOTE(kumar.dinesh1984 @ 12 Jun, 2008 - 08:23 PM) *

what is package?
how to call/access package?
how to access public class in other package?????
plz help me.....................


one single line in your Java source file

import <packageName>;

don't know if you know C but it is kind of like the "include" keyword
In C you include data definition like struct and variables in Java you only import class definition

By default Java

import java.lang.*;

if you want to use AWT you have to

import java.awt.*;

if you don't import the class definition you can declare it explicitely

java.awt.Frame Frame = new java.awt.Frame();


This post has been edited by pbl: 12 Jun, 2008 - 07:36 PM
User is online!Profile CardPM
+Quote Post

mensahero
RE: How To Call/access Package
12 Jun, 2008 - 07:28 PM
Post #3

c0mput3rz Are Only Human
Group Icon

Joined: 26 May, 2008
Posts: 664



Thanked: 17 times
Dream Kudos: 75
My Contributions
You Got A PACKAGE.. CLICK ME..


blink.gif .. everything you need to know.. is just a single click away.. blink.gif
User is offlineProfile CardPM
+Quote Post

pbl
RE: How To Call/access Package
12 Jun, 2008 - 07:30 PM
Post #4

D.I.C Lover
Group Icon

Joined: 6 Mar, 2008
Posts: 3,587



Thanked: 233 times
Dream Kudos: 75
My Contributions
QUOTE(mensahero @ 12 Jun, 2008 - 08:28 PM) *

You Got A PACKAGE.. CLICK ME..


blink.gif .. everything you need to know.. is just a single click away.. blink.gif


Mensahero I'll give you a "thank" for that one
This one will think that DIC answer quite fast
User is online!Profile CardPM
+Quote Post

mensahero
RE: How To Call/access Package
12 Jun, 2008 - 07:37 PM
Post #5

c0mput3rz Are Only Human
Group Icon

Joined: 26 May, 2008
Posts: 664



Thanked: 17 times
Dream Kudos: 75
My Contributions
QUOTE


Mensahero I'll give you a "thank" for that one
This one will think that DIC answer quite fast


.. Just recently I've tried to solve one simple C problem.. and when I got the answer.. the thread already has 16 replies.. wow.. DIC is really fast.. lmao..blink.gif

This post has been edited by mensahero: 12 Jun, 2008 - 07:38 PM
User is offlineProfile CardPM
+Quote Post

pbl
RE: How To Call/access Package
12 Jun, 2008 - 07:46 PM
Post #6

D.I.C Lover
Group Icon

Joined: 6 Mar, 2008
Posts: 3,587



Thanked: 233 times
Dream Kudos: 75
My Contributions
QUOTE(mensahero @ 12 Jun, 2008 - 08:37 PM) *

QUOTE


Mensahero I'll give you a "thank" for that one
This one will think that DIC answer quite fast


.. Just recently I've tried to solve one simple C problem.. and when I got the answer.. the thread already has 16 replies.. wow.. DIC is really fast.. lmao..blink.gif

I wish I was working in Java but the only thing I've found is C programming where you try to fit 65KB of code on 64KB boards.... at least being active here ler me keep my Java knowledge (actually learned a lot from DIC problems)
User is online!Profile CardPM
+Quote Post

prajayshetty
RE: How To Call/access Package
13 Jun, 2008 - 07:56 AM
Post #7

D.I.C Head
Group Icon

Joined: 27 Apr, 2007
Posts: 230



Thanked: 1 times
Dream Kudos: 25
My Contributions
QUOTE(pbl @ 12 Jun, 2008 - 08:46 PM) *

QUOTE(mensahero @ 12 Jun, 2008 - 08:37 PM) *

QUOTE


Mensahero I'll give you a "thank" for that one
This one will think that DIC answer quite fast


.. Just recently I've tried to solve one simple C problem.. and when I got the answer.. the thread already has 16 replies.. wow.. DIC is really fast.. lmao..blink.gif

I wish I was working in Java but the only thing I've found is C programming where you try to fit 65KB of code on 64KB boards.... at least being active here ler me keep my Java knowledge (actually learned a lot from DIC problems)


well javas programing has a following steps


1) is the package declearation
2) import deleceration
3)interface statement
4)class definations
5) main class name
just define a package like this code:
filename code.java

CODE

package student;

import java.util.*;

import java.io.*;
imort java.lang.*;
class students
{
int a;
int b;
int c;
string len,len1;
public int getdata()
{

Scanner s = new Scanner(System.in);
System.out.println("Enter a and b");
len=s.nextline();
len1=s.nextline();
a=Integer.valueOf(len);
b=Integer.valueOf(len1);
c=a+b;
return c;
}
}


to use this function just use

import student.students;

i hope this example is useful

This post has been edited by prajayshetty: 13 Jun, 2008 - 07:58 AM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 10:50PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month