• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Explain please.

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 436
2
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 76395
364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 76395
364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author & internet detective
Posts: 41250
849
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Everybody's invited. Even this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic