Bookmark Topic Watch Topic
  • New Topic

Learning Java - the unusual method  RSS feed

 
Rajib Ban
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Report post to moderator
I am learning Java.

The usual method of Hello World program does not appear to be an ideal method of learning a language.

There has to be a code which uses a fairly difficult but understandable program example to explain Java programs.

Such as two spheres in elastic collisions in an enclosure with rigid walls.

Then a book that contains a comprehensive list of java objects and how they are used in programs, each in relation to the other? Like the c programmers has c standard libraries? Or the Adobe Flash having action script objects?

The mathematical tools and objects and how they are used?
 
Rajib Ban
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Report post to moderator
Searched the internet and found one:
Introduction - The World Of Bouncing Balls
I will go through the codes. Would someone help me when I stumble?
The first query remains valid:
... a book that contains a comprehensive list of java objects and how they are used in programs, each in relation to the other? Like the c programmers has(sic, have) c standard libraries? Or the Adobe Flash having action script objects? ...
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16007
87
Android IntelliJ IDE Java Scala Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Report post to moderator
Welcome to the Ranch.

Java has its own standard library, and the reference documentation is available online. It is, however, reference documentation, and not a tutorial, so it tells you exactly which interfaces, classes and methods are there, but it does not say a lot about how these all work in relation to each other.

Of course, if you have specific questions, people in the forums here are happy to help you learn and answer your questions.
 
Rajib Ban
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Report post to moderator
Jesper de Jong said:
... Welcome to the Ranch. ...


... Java has its own standard library, and the reference documentation is available online. It is, however, reference documentation, and not a tutorial, so it tells you exactly which interfaces, classes and methods are there, ...

Okay, understood, but thanks. I will have a look around in the next couple of weeks.

... but it does not say a lot about how these all work in relation to each other. ...

Then is there a book or resource that does?

I copied the Example 1: Getting Started with One Bouncing Ball of the webpage The World Of Bouncing Balls. Runs in Eclipse by copying-pasting the said code, saving, renaming with extension BouncingBallSimple.java in src folder within the project folder

Ran the java file BouncingBallSimple.java and studied it. In the next post I will have my queries posted.
 
Campbell Ritchie
Sheriff
Posts: 55351
157
  • Likes 1
  • Mark post as helpful
  • send pies
  • Report post to moderator
Welcome to the Ranch again.
Rajib Ban wrote:. . . Then a book that contains a comprehensive list of java objects . . .
As Jesper has said, you use the documentation link. It will take some time to become familiar with it, unfortunately. The nearest you will find to a book describing the API is probably something like Java in a Nutshell by Flanagan or Evans and Flanagan, but I don't particularly like that book myself. Anyway, it is impossible to print a book which both contains the comprehensive API and is light enough to carry. So use the original link and keep your money for something else.
If you really are learning, then I don't think that bouncing ball website will help you. It is too difficult for somebody without experience (you might have more experience than we think, however) and shows several features which I think aren't good practice. Also, you probably won't learn anything useful from copied code. You might be better off copying the code by hand, and here, some of our more experienced people warn against copying code automatically. If you really are beginning learning, I think that bouncing ball example constitutes biting off more than you can chew and I think you shou‍ld start simpler, like everybody else.

As for mathematical tools, the standard API provides little of that sort. There are functions to calculate things like log cos sin etc., but I am not aware of anything in the standard API more complicated than converting between polar and Cartesian coordinates. There are doubtless lots of mathematical tools available elsewhere. Most programming doesn't use complicated maths anyway.

It would appear that the one thing you will learn from that website is how to run code with Eclipse. But I am not convinced you have got that right. The way I would do that in Eclipse is more like this:-
  • 1: New Project, called Balls or similar.
  • 2: Create New Package.
  • 3: New class: named BouncingBallSimple
  • 4: Write the code in the class.
  •  
    Liutauras Vilda
    Marshal
    Posts: 4521
    308
    BSD
    • Mark post as helpful
    • send pies
    • Report post to moderator
    Rajib Ban wrote:The usual method of Hello World program does not appear to be an ideal method of learning a language.

    It may or may not be an ideal, but need to start somewhere. Probably about 95% of tutorials could show "Hello World" version written in OO way, that would teach probably more than it does now. Regardless, from every piece of code you can learn something and then gradually move on once you fully understand an example at hand.


    For a start, try to understand this statement and its separate pieces. That may be more challenging than you think. Go to its implementation details and you'll see.
     
    Rajib Ban
    Ranch Hand
    Posts: 82
    • Mark post as helpful
    • send pies
    • Report post to moderator

    Yes, I agree. I shall try to follow your other advices.
    But I am not convinced you have got that right. The way I would do that in Eclipse is more like this:-
    1: New Project, called Balls or similar.
    2: Create New Package.
    3: New class: named BouncingBallSimple
    4: Write the code in the class.

    Okay! Thank you!
     
    Liutauras Vilda
    Marshal
    Posts: 4521
    308
    BSD
    • Mark post as helpful
    • send pies
    • Report post to moderator
    May I give you an example.

    Its standard form of presentation of Hello World program is:

    This and the version below aren't object oriented, but the bottom one is slightly improved:

    As you see we got out of static context and having instance created as well as we can either accept greeting message from command line arguments or print default message, so it has more flexibility. But still, it is very procedural.

    Below let's have a look at a bit more object oriented version of Hello World:

    Now we see a bit more flexible and a bit more object oriented version. Unfortunately as you see we still have lots of hard coded parts, which explicitly mentions HelloWorld, and such code still violates many SOLID principles, so we haven't solved so much of inflexibility problems.

    So what we can do next? We can program to interface, which suggests Interface segregation principle (one of SOLID principles).

    So we can create an interface for message provider and an interface message renderer:

    And their corresponding implementations. Note, not much of actual implementation changed, apart from the fact, that we got rid of implicit HelloWorld... implementation details, meaning all parameters and fields referring to its interface rather than concrete implementation, and that is way more flexible now:

    Now, is it best what we can do? No. We still have in HelloWorldDecoupledInterface hardcoded StndardOutMessageRenderer and HelloWorldMessageProvider, and in case we need one of those different implementations, we'd need to recompile code in order to do that.

    So what we can do about it to go away of it? We could create some property file where we could have configured that, and moving along that you can learn what is dependency injection, such frameworks as Spring and how they can be helpful in achieving that.

    So as you see, there are tons of stuff to learn using only Hello World example and gradually improving it.

    After all, I think "Hello World" is an ideal example of teaching beginners, of course if it isn't bounded to procedural code techniques.
     
    Rajib Ban
    Ranch Hand
    Posts: 82
    • Mark post as helpful
    • send pies
    • Report post to moderator
    Are the public and private declarations mean something as follows:
    Public: Something that is available across the entire Java programming interface?
    Private: Something that is available within a program a user such as me has created?
    Then, with respect to http://docs.oracle.com/javase/8/docs/api/ where are these functions?:
    I found here /java.awt/Class Graphics/java.lang.Object/java.awt.Graphics the following"

    and so on ...

    Further, I found the following links:


    Graphics (Java Platform SE 8 ) - Oracle Help Center ...
    setColor. public abstract void setColor(Color c). Sets this graphics context's current color to the specified color. All subsequent graphics operations using this


    JLayer (Java Platform SE 8 ) - Oracle Help Center
    setColor(new Color(0, 128, 0, 128)); g.fillRect(0, 0, c.getWidth(), c.getHeight()); } public void installUI(JComponent c) { super.installUI(c); // enable mouse motion ...


    Painter (Java Platform SE 8 ) - Oracle Help Center
    Painter<Component> p = new Painter<Component>() { public void paint(Graphics2D g, Component c, int width, int height) { g.setColor(c.getBackground()); //and ...


    Graphics2D (Java Platform SE 8 ) - Oracle Help Center
    The Graphics class defines only the setColor method to control the color to be painted. ..... public abstract void drawGlyphVector(GlyphVector g, float x, float y).


    JColorChooser (Java Platform SE 8 ) - Oracle Help Center. Sets the current color of the color chooser to the specified RGB color. void, setDragEnabled(boolean b). Sets the dragEnabled ...


    Color (Java Platform SE 8 ) - Oracle Help Center
    Creates an opaque sRGB color with the specified red, green, and blue values in the range (0 - 255). . Creates an sRGB color with the ...


    MediaTracker (Java Platform SE 8 ) - Oracle Help Center
    statusAll(false) & MediaTracker.ERRORED) != 0) { g.setColor(Color.red); g.fillRect(0, 0, size().width, size().height); return; } g.drawImage(bg, 0, 0, this); if (tracker.
     
    Rajib Ban
    Ranch Hand
    Posts: 82
    • Mark post as helpful
    • send pies
    • Report post to moderator
    @Campbell Ritchie:
    It would appear that the one thing you will learn from that website is how to run code with Eclipse. But I am not convinced you have got that right. The way I would do that in Eclipse is more like this:-
    1: New Project, called Balls or similar.
    2: Create New Package.
    3: New class: named BouncingBallSimple
    4: Write the code in the class.

    I deleted the entire project that I had created by my method. I then created, following your method, the class as advised, like as follows:

    Now, on the one hand I have this class following your advice, on the other, the entire BouncingBallSimple.java file that I manually created by a text file.
    All that remains is to remove the codes made by eclipse and replace them by the codes in the text file!
    Virtually, they are identical, aren't they?
     
    Henry Wong
    author
    Sheriff
    Posts: 23282
    125
    C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
    • Mark post as helpful
    • send pies
    • Report post to moderator
    Rajib Ban wrote:
    Now, on the one hand I have this class following your advice, on the other, the entire BouncingBallSimple.java file that I manually created by a text file.
    All that remains is to remove the codes made by eclipse and replace them by the codes in the text file!
    Virtually, they are identical, aren't they?


    There is a reason why IDEs are not recommended for beginners. As you can see, you have went from learning Java, to giving priority to learning the intricacies of learning the IDE.

    Henry
     
    Henry Wong
    author
    Sheriff
    Posts: 23282
    125
    C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
    • Mark post as helpful
    • send pies
    • Report post to moderator
    Rajib Ban wrote:
    Then a book that contains a comprehensive list of java objects and how they are used in programs, each in relation to the other? Like the c programmers has c standard libraries? Or the Adobe Flash having action script objects?


    I can't really help you here, as I learned Java before many of the libraries became available -- and obviously didn't take the optimal path.

    But...

    Rajib Ban wrote:Searched the internet and found one:
    Introduction - The World Of Bouncing Balls
    I will go through the codes. Would someone help me when I stumble?


    This is probably not a good idea. If you are trying to learn Java from scratch, meaning zero knowledge, then Graphics (along with GUI environments) is not really a good first library to learn... but regardless, if you want to try, then good luck.

    Henry
     
    Rajib Ban
    Ranch Hand
    Posts: 82
    • Mark post as helpful
    • send pies
    • Report post to moderator
    @Henry Wong
    Sir, thanks! I was only making an observation, as an aside, not asking for specific assurances that the two are virtually identical or different. I did not move away from learning Java to learning the IDE! I am still in Java :-)
     
    Rajib Ban
    Ranch Hand
    Posts: 82
    • Mark post as helpful
    • send pies
    • Report post to moderator
    @Liutauras Vilda:
    So what we can do about it to go away of it?
    Did you mean to say: "So what we can do about it to have the complicated code go away?"

    We could create some property file where we could have configured that, and moving along that you can learn what is dependency injection, such frameworks as Spring and how they can be helpful in achieving that.

    You have lost me on that. May be, over time, I will understand what you have meant to say, but not now.
    Of course, I understood what you meant by those examples, like you stated:
    So as you see, there are tons of stuff to learn using only Hello World example and gradually improving it.

    I get that point, but not your codes. If I run them individually shall I be able to experience different responses from the console?
     
    Rajib Ban
    Ranch Hand
    Posts: 82
    • Mark post as helpful
    • send pies
    • Report post to moderator
    The code :
    It is intuitive enough! Like the System is to create an output in the form of a printed line "Hello World!"
    I understand that the code lines are written in an unusual form because the original developers designed the software in that peculiar form. I don't know what machine language is created when I write those codes. Maybe, the Assembly Language programmers would know better!
    Now, since Oracle Java platform doesn't have a search option (there could be, but I could not find one) I used Google to find about the public static void main(String[] args) in http://docs.oracle.com/javase/8/docs/api
    What does this code signify? It looks very harmless, but isn't. Where in the said site can I find a reference to it specifically?
    I looked up http://docs.oracle.com/javase/8/docs/api/index-files/index-1.html
    For example, there are four PUBLIC keywords:
    PUBLIC - Static variable in class java.lang.invoke.MethodHandles.Lookup
        A single-bit mask representing public access, which may contribute to the result of lookupModes.
    PUBLIC - Static variable in interface java.lang.reflect.Member
        Identifies the set of all public members of a class or interface, including inherited members.
    PUBLIC - Static variable in class java.lang.reflect.Modifier
        The int value representing the public modifier.
    PUBLIC - Static variable in interface javax.swing.text.html.parser.DTDConstants


    STATIC - Static variable in class java.lang.reflect.Modifier
        The int value representing the static modifier.


    Two voids
    Void - Class in java.lang
        The Void class is an uninstantiable placeholder class to hold a reference to the Class object representing the Java keyword void.
    VOID - Static variable in class javax.management.openmbean.SimpleType
        The SimpleType instance describing values whose Java class name is java.lang.Void.


    MAIN - Static variable in class javax.print.attribute.standard.MediaTray
        The main input tray in the printer.
    MAIN_CLASS - Static variable in class java.util.jar.Attributes.Name
        Name object for Main-Class manifest attribute used for launching applications packaged in JAR files.


    String - Class in java.lang
        The String class represents character strings.
    String() - Constructor for class java.lang.String


    args
    I didn't find anywhere!


     
    Henry Wong
    author
    Sheriff
    Posts: 23282
    125
    C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
    • Mark post as helpful
    • send pies
    • Report post to moderator
    Rajib Ban wrote:
    What does this code signify? It looks very harmless, but isn't. Where in the said site can I find a reference to it specifically?


    All "hello world" programs have boilerplate -- and Java seems to have more than others. And the reason for this, is because it is not possible to learn anything from zero, without it. There simply have to be stuff to be learned later, and kept as boilerplate.

    So, you have two choices. One, you can move along with the book / tutorial that you are using, to supposedly take the optimal path of learning. Or two, you can deal with all the boilerplate. Making sure that you learn everything, before moving on, even though this is definitely not the optimal path.

    Personally, I don't have a strong opinion on this. If you don't care about the optimal learning path, we can still address your questions, if you like...

    Henry
     
    Rajib Ban
    Ranch Hand
    Posts: 82
    • Mark post as helpful
    • send pies
    • Report post to moderator
    Henry Wong wrote:If you don't care about the optimal learning path, we can still address your questions, if you like... Henry

    Yes, I would like very much. But it has to be at my level of understanding, or at least, which could drive me to a deeper understanding of Java :-) Regards, Rajib
     
    Henry Wong
    author
    Sheriff
    Posts: 23282
    125
    C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
    • Mark post as helpful
    • send pies
    • Report post to moderator
    Rajib Ban wrote:
    Yes, I would like very much. But it has to be at my level of understanding, or at least, which could drive me to a deeper understanding of Java :-)


    Well, to be blunt, it will *not* be the optimal learning path. So, it will be harder than the tutorials in the normal fashion. If you are having issues with your current tutorials / books, well, this will be worse.

    Anyway, let me tackle a few with pointers, and you can decide whether it is a good idea.

    Henry
     
    Henry Wong
    author
    Sheriff
    Posts: 23282
    125
    C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
    • Mark post as helpful
    • send pies
    • Report post to moderator
    Rajib Ban wrote:
    For example, there are four PUBLIC keywords:
    PUBLIC - Static variable in class java.lang.invoke.MethodHandles.Lookup
        A single-bit mask representing public access, which may contribute to the result of lookupModes.
    PUBLIC - Static variable in interface java.lang.reflect.Member
        Identifies the set of all public members of a class or interface, including inherited members.
    PUBLIC - Static variable in class java.lang.reflect.Modifier
        The int value representing the public modifier.
    PUBLIC - Static variable in interface javax.swing.text.html.parser.DTDConstants



    First, none of those listed are correct. And second, none of those are even keywords.

    The "public" being referred to here is the access modifier for the main() method.

    Here is a link to the access modifier portion of the Oracle Java tutorial ... https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html

    Henry
     
    Henry Wong
    author
    Sheriff
    Posts: 23282
    125
    C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
    • Mark post as helpful
    • send pies
    • Report post to moderator
    Rajib Ban wrote:
    STATIC - Static variable in class java.lang.reflect.Modifier
        The int value representing the static modifier.



    Nope. This isn't correct either. The "static" being referred to is related to the main() method being a class method. To understand that, you need to kinda understand classes, and specifically, this criteria of classes...

    https://docs.oracle.com/javase/tutorial/java/javaOO/classvars.html

    Henry
     
    Rajib Ban
    Ranch Hand
    Posts: 82
    • Mark post as helpful
    • send pies
    • Report post to moderator
    Liutauras Vilda wrote:


    The above code doesn't produce any special output. Then why is this used?

    The rest codes I will visit sequentially and report back!
     
    Knute Snortum
    Sheriff
    Posts: 3974
    98
    Chrome Eclipse IDE Java Postgres Database VI Editor
    • Mark post as helpful
    • send pies
    • Report post to moderator
    The above code doesn't produce any special output. 

    What do you mean by "special output"?  It prints "Hello World" to the console if you don't pass it any arguments.

    How are you executing the program?
     
    Rajib Ban
    Ranch Hand
    Posts: 82
    • Mark post as helpful
    • send pies
    • Report post to moderator
    Even when I create three classes:
    1. public class HelloWorldDecoupled
    2. public final class HelloWorldMessageProvider
    3. public final class StandardOutMessageRenderer
    I get the same console output.
    So each of the classes need to be explained, but at my level, including the references to a Standard Reference of the functions used. If not possible presently, then I could wait!
     
    Rajib Ban
    Ranch Hand
    Posts: 82
    • Mark post as helpful
    • send pies
    • Report post to moderator
    Knute Snortum wrote: It prints "Hello World" to the console if you don't pass it any arguments.
    How are you executing the program?

    How do I pass it arguments? I am executing via Eclipse 'Run'.
     
    Henry Wong
    author
    Sheriff
    Posts: 23282
    125
    C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
    • Mark post as helpful
    • send pies
    • Report post to moderator
    Rajib Ban wrote:
    So each of the classes need to be explained, but at my level, including the references to a Standard Reference of the functions used. If not possible presently, then I could wait!


    Yeah. If you don't tell us what you did, how you ran the code, and what the output is, you are unlikely to get any useful response. Sorry, but we need details.

    Henry
     
    Liutauras Vilda
    Marshal
    Posts: 4521
    308
    BSD
    • Mark post as helpful
    • send pies
    • Report post to moderator
    Rajib Ban wrote:How do I pass it arguments? I am executing via Eclipse 'Run'.

    Executing program via console, is easier to pass arguments in my opinion.
     
    Dave Tolls
    Ranch Hand
    Posts: 2839
    30
    • Mark post as helpful
    • send pies
    • Report post to moderator
    Rajib Ban wrote:
    How do I pass it arguments? I am executing via Eclipse 'Run'.


    These would work better from the command line (unless you want to learn how to use Eclipse).

    java HelloWorld

    for no arguments, or

    java HelloWorld Mind the oranges, Marlon!

    to go through the bit of code that handles the args.
     
    Knute Snortum
    Sheriff
    Posts: 3974
    98
    Chrome Eclipse IDE Java Postgres Database VI Editor
    • Mark post as helpful
    • send pies
    • Report post to moderator
    Rajib Ban wrote:So each of the classes need to be explained, but at my level, including the references to a Standard Reference of the functions used. If not possible presently, then I could wait!

    It is going to be a lot easier for you and us if you take the time to go through a standard tutorial like this one.

    Barring that, what exactly don't you understand? 
     
    Campbell Ritchie
    Sheriff
    Posts: 55351
    157
    • Mark post as helpful
    • send pies
    • Report post to moderator
    Rajib Ban wrote:. . . It is intuitive enough! . . .
    That is obviously not intuitive because you have got it wrong.
    . . . . I don't know what machine language is created when I write those codes. . . .
    You don't need to know anything about machine code.
    Now, since Oracle Java platform doesn't have a search option . . . .
    The API does however have an index.
    What does this code signify? . . . Where in the said site can I find a reference to it specifically?
    Nowhere. No classes in the public API can start an application so none of them has a main method.
    . . . For example, there are four PUBLIC keywords: . . .
    Those aren't keywords at all. The fifty keywords are listed in the Java® Language Specification along with the three non‑keyword reserved words. It also tells you about the main method. As it says there, invoking the main method is the first stage in execution of an application.
     
    Campbell Ritchie
    Sheriff
    Posts: 55351
    157
    • Mark post as helpful
    • send pies
    • Report post to moderator
    A few minutes ago, I wrote:. . . not intuitive because you have got it wrong. . . .
    I got that bit wrong when I was starting, too. It needs explanation, but I hven't got the time to explain it now.
     
    Rajib Ban
    Ranch Hand
    Posts: 82
    • Mark post as helpful
    • send pies
    • Report post to moderator
    Dr. Henry Wong, Dr. Dave Tolls and Dr. Liutauras Vilda,
    Dave Tolls wrote:These would work better from the command line (unless you want to learn how to use Eclipse).

    Yes, I understand. So I made three files, HelloWorldDecoupled.java, HelloWorldMessageProvider.java and StandardOutMessageRenderer.java as follows:




    and



    went to the folder of eclipse and then typed on the terminal, , and in the src folder itself, rather than the bin folder of Eclipse. The codes made three class files, HelloWorldDecoupled.class, HelloWorldMessageProvider.class and StandardOutMessageRenderer.class .

    The following Dr. Tolls's advice:
    Dave Tolls wrote:
    java HelloWorld
    for no arguments, or
    java HelloWorld Mind the oranges, Marlon!
    to go through the bit of code that handles the args.

    I typed first The output was:

    Then, The output was the same:

     
    Rajib Ban
    Ranch Hand
    Posts: 82
    • Mark post as helpful
    • send pies
    • Report post to moderator
    Campbell Ritchie wrote:I got that bit wrong when I was starting, too. It needs explanation, but I hven't got the time to explain it now.

    Okay, no issues! Please do take your time!
     
    Henry Wong
    author
    Sheriff
    Posts: 23282
    125
    C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
    • Mark post as helpful
    • send pies
    • Report post to moderator
    Rajib Ban wrote:
    I typed first The output was:


    Yes. Based on your code, this supposed to happen.
    Rajib Ban wrote:
    Then, The output was the same:


    And yes. Based on your code, this is also supposed to happen.

    Were you expecting something else?

    Henry
     
    Knute Snortum
    Sheriff
    Posts: 3974
    98
    Chrome Eclipse IDE Java Postgres Database VI Editor
    • Mark post as helpful
    • send pies
    • Report post to moderator
    The program that uses arguments from the command line is the one below.  HelloWorldDecoupled.java doesn't use command line arguments.
     
    Rajib Ban
    Ranch Hand
    Posts: 82
    • Mark post as helpful
    • send pies
    • Report post to moderator
    @Dr. Wong @Dr.Snortum,
    Knute Snortum wrote:The program that uses arguments from the command line is the one below.  HelloWorldDecoupled.java doesn't use command line arguments ...
    I now understand where Eclipse fails! I don't know if it fails, or it is my misunderstanding, but I can't pass arguments in Eclipse from its console.

    Now for the argument passing code, I type and it compiles without error. When I write at the command prompt of the terminal it shows message:
    Hello World!


    But when I write: the console shows:
    hi
    hello
    with line breaks in between. Why so?
    Henry, that "hi hello" is what I meant as special outputs. This wasn't happening in Eclipse. Rather, I should say that I don't know how to use eclipse to pass arguments.
     
    Liutauras Vilda
    Marshal
    Posts: 4521
    308
    BSD
    • Mark post as helpful
    • send pies
    • Report post to moderator
    Rajib Ban wrote:with line breaks in between. Why so?

    Buddy, you mentioned at the beginning:
    Rajib Ban wrote:The usual method of Hello World program does not appear to be an ideal method of learning a language.
    There has to be a code which uses a fairly difficult...

    and I think you were mistaken about this statement. While you don't understand Hello World written in its simplest form, there is no point in going further towards more difficult code.

    This thread is already going in a quite chaotic way (in my opinion), and going same way any further will make it worse, I'm afraid.

    I have mentioned to you before:
    Liutauras Vilda wrote:For a start, try to understand this statement and its separate pieces.

    Did it happen? If not, why are you trying to go any further?

    Start small, go big.
     
    Campbell Ritchie
    Sheriff
    Posts: 55351
    157
    • Mark post as helpful
    • send pies
    • Report post to moderator
    Rajib Ban wrote:. . . I can't pass arguments in Eclipse from its console. . . .
    No, there is a different window on Eclipse for passing command line arguments. Once you have entered arguments, those arguments stay there for ever . . . or until you go back to the window and change them.
    You can still use the console for Scanner inScan = new Scanner(System.in); or similar. Note that input to the Eclipse console changes automatically to green text.

    You were asking about System.out.println yesterday. It just so happens that somebody else asked about the same thing today, so I wrote an explanation here.
     
      Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!