How to use packages in Java. Packages are an important tool for organising your code; you’ll also need to understand packages to use other people’s code.
When the video is running, click the maximize button in the lower-right-hand corner to make it full screen.
Code for this tutorial:
App.java:
import ocean.Fish;
import ocean.plants.Seaweed;
public class App {
public static void main(String[] args) {
Fish fish = new Fish();
Seaweed weed = new Seaweed();
}
}
Fish.java:
package ocean;
public class Fish {
}
Algae.java:
package ocean.plants;
public class Algae {
}
Seaweed.java:
package ocean.plants;
public class Seaweed {
}
Aquarium.java:
package com.caveofprogramming.oceangame;
public class Aquarium {
}
Learn to program Java Swing with my complete video course – desktop programming and applets. Includes 7 free videos. Click here for details.
All pages on this site are copyright © 2013 John W. Purcell