Whats up guys i recenlty lernt something very interesting called a Package
so basically what a package is like u write your daily programmes same way
u write your pckages but the difference is the u dont run your packages you just compile
them and leve them NOTE when we are writing a package the methods or functions
or the classes created are not called that is you dont write the main function you just
create class its member functions and compile them The syntax is shown below
1--- here package is a ke word used to define the name of package
my package is the name of the package
and as you can see it simply prints ymca on screen
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
package mypackage;
public class My{
public void myy(){
System.out.println("ymca");
}
}
so basically what a package is like u write your daily programmes same way
u write your pckages but the difference is the u dont run your packages you just compile
them and leve them NOTE when we are writing a package the methods or functions
or the classes created are not called that is you dont write the main function you just
create class its member functions and compile them The syntax is shown below
1--- here package is a ke word used to define the name of package
my package is the name of the package
and as you can see it simply prints ymca on screen
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
package mypackage;
public class My{
public void myy(){
System.out.println("ymca");
}
}
]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
2-- How to use it
To use this package we have to import it in our main class and call the function of this package using
the object of class in the package
NOTE-we dont create the package and the main function in one notepad window or whatever editor you are using
here is an example to import a package
this programme just makes the object of class and calls its functions
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
import mypackage.*;
import java.io.*;
class First{
public static void main(String args[])
{
My object=new My();
object.myy();
}
}
]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
NOTE--these are some steps you need to folloy in order to run a package
1-create the package and store it in a folder with folder name same as package name
2-come out of thet folder and same the programme in which you are using package
3-compile the package dont run it
4-then compile the programme in which you are using the package
5-run and enjoy
No comments:
Post a Comment