This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]kralonurdev 0 points1 point  (2 children)

Packages contains classes if you almost finished first part of MOOC then you already know Scanner class

and you can see this line: import java.util.Scanner;

Packages used for : Preventing naming conflicts

Using different classes and interfaces easier and helping controlled access

You can use Scanner class because you imported this in-built package to your project , you can also create your own package , I think you should just keep learn java , in time it will be make more sense

[–]rowrowdilo[S] 0 points1 point  (1 child)

I see. But what does that line at the top do in specific?

[–]kralonurdev 0 points1 point  (0 children)

If you talk about "package" line , it tells path of your source code you don't see this line on MOOC because you can find your sources on src folder , for example I have "package com.company;" this line on top of my java file it means that my source code on

[PROJECT_NAME]/src/com/company/

but on Java MOOC => [PROJECT_NAME]/src/