50 - Packages ( package; compile; import; @argfiles ) | Java Tutorials

preview_player
Показать описание
Learn how to group your class files together with a package. This video goes over single packages, packaging multiple packages, importing packages, compiling, running, shortcuts for compiling multiple classes and packages at a time, good practices for naming and creating your project folder structure, and is just the best video ever.

| Language
Java (.java /.class)

| Code Example
Рекомендации по теме
Комментарии
Автор

00:11 - what, why, naming conventions
01:52 - setup
03:30 - default package
04:49 - creating a package
06:26 - compiling a package to anywhere
07:21 - compiling a package to current directory
08:10 - running a class in a package
08:39 - multiple packages, importing packages
09:43 - compile multiple packages at once
10:14 - src & bin folders
13:17 - compiling & running from subdirectories
14:17 - compiling with a @argfiles text file
16:08 - sub packages
18:33 - outro

SimplyCoded
Автор

I gotta say that I learned a lot more than what your video title awesome!

finnzhang
Автор

Amazing content. I was stuck for a while trying to write JUnit tests and compiling several data structures in multiple packages. What a great tutorial.

andrewbabilonia
Автор


You Suddenly made me LOVE Java even more .
Such a neat Presentation and so Solid Explanation .
By this video, you cleared lot of other stuff in which we usually face problem during practical applications. .

Voice Quality is Awesome. ( You have such a cool Voice )
Video Quality is Lovely .
Time Management is Fantastic .
Way of Explanation is Superb .

I have subscribed to your channel .
I am desperately waiting for more Coding Tutorial videos.
Keep on Posting Videos Like these . I am running out of words to thank you .
By the way, which Software you use for Recording Screen ?

kunal_chand
Автор

I hope this was clear but you can add more packages to your bin folder, and import them into any class. For example if I added this package from say 'www.fighting.com' (made up name) to my bin folder:

package com.fighting.combat;
//
public interface Attackable {
void setHealth(double health);
double getHealth();
double getSize();
}

Then I could use it in my Frog class like this...

package animals.amphibians;
import
//
public class Frog implements Attackable {
private double health, size;

public void speak() {
System.out.println("Ribbit");
}

public Frog() {
health = 100;
size = 16;
}

public void setHealth(double health) {
this.health = health;
}

public double getHealth() {
return health;
}

public double getSize() {
return size;
}
}

SimplyCoded
visit shbcf.ru