johnson james

Greenhorn
+ Follow
since Feb 12, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by johnson james

Vishal, thanks for your quick reply. I started learning basics of java by myself and searching for all available help. I cant find any help explaining the rules of using curly brackets. I would appreciate any help.
15 years ago
Thank you Campbell for your help!

Another question I have is when to use curly brackets? Does the position of curly brackets matters?
15 years ago

fred rosenberger wrote:First, welcome to the javaranch. Glad you came by!

You may want to read some of this. It gives you a good idea how to get the most from this site.

Many folks are going to read your post and not bother. It appears to the reader like you are asking us to do your work for you - i.e. that you've put NO effort at all into figuring things out.

If you have specific questions, then by all mean, ask them, but a blanket post of "what does all this mean" will turn many folks off from helping you.

Now, to answer your specific question... the first line is called an import statement. It's telling java that you are going to use some special, pre-written classes, and where to find them. Java will use that when it parses your code. If it is not obvious where the class is, it will basically look in the directories named in the various import statements (you can have more than one import).

You can write your code without ever using imports, but then you'd have to refer to some classes by really long names. using the import saves some typing.

Thanks for the quick reply
15 years ago
What are each line of code stand for also each syntax? eg: why we need to write "import java.io.*? I would really appreciate if someone can help with this. Thank you in advance!
=============================

[edit]Add code tags. CR[/edit]
15 years ago