• Post Reply Bookmark Topic Watch Topic
  • New Topic

Explain please.  RSS feed

 
Eric Zinzer
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I am total beginner. Can someone explain every word/line for following source:


For example: import means - ...
public class means - ...


I will be really grateful. I have doubts and want to clear them up.

Thanks.
 
Hauke Ingmar Schmidt
Rancher
Posts: 436
2
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure, the Java tutorial can be found here: https://docs.oracle.com/javase/tutorial/

Most helpful for this would be "Learning the Java Language": https://docs.oracle.com/javase/tutorial/java/index.html

Formally everything is explained in the Java Language Specification: http://docs.oracle.com/javase/specs/jls/se8/html/index.html
 
Campbell Ritchie
Marshal
Posts: 55789
164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Please tell us where that code comes from. It is pretty horrible to read.
 
Campbell Ritchie
Marshal
Posts: 55789
164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The one part you might find difficult to explain if you read the tutorials which HIS sent links to (thank you) is explanation of import. You can read about imports in the Java® Language Specification (=JLS) but that can be very difficult to understand.
The class BufferedReader in that code is in a location which the compiler cannot predict. If you write java.io.BufferedReader, then the java.io. bit (=package name) is sufficient for the compiler to find the BufferedReader class. If you write
import java.io.BufferedReader;
which must be before the first class name in the file, then the compiler will assume that you mean java.io.BufferedReader every time you write BufferdReader. And then it can find the class you wish to use.

I said that was horrible code. It is also very old‑fashioned. The use of buffered readers and parse methods together was superseded in 2004.
You appear to have copied the class name wrongly. It should not be 11; maybe they meant 11, because identifiers must not begin with numbers.

And that shows how careful one has to be with the letter after K and before M because it can be confused with the number between 0 and 2.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37256
519
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about you tell us what you understand or think it means and we will correct you. If you don't know what any of the lines mean, you need a book on Java. If you know what some of them mean, you can narrow it down for us.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!