Announcement

Collapse
No announcement yet.

java phailing

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • java phailing

    I'm very new to java and programming in general, so I'm hoping this will be an easy fix, so here goes...

    This is a little app I wrote to compare md5 sums of downloaded packages with the source, its real simple, I expected it to be no problem but I'm starting to realize just how bad at this I am

    Anyway I finally got it to compile and now when I run it with 'java md5Check' it doesn't return anything and just returns to BASH prompt.

    Thanks for any input


    Code:
    import java.util.Scanner;
    /**
    This will take the suck out of confirming md5 sums.
     */
    public class md5Check
    {
    
        public String sum1;
        public String sum2;
    
        public static void main( String args[] )
        {
        }
            public void input()
            {
                System.out.println( "First checksum?" );
            
                Scanner input = new Scanner ( System.in);
            
                String sum1 = input.nextLine();
            
                System.out.println( "Second checksum?" );
            
                String sum2 = input.nextLine();
                
            }
        
            public void verify()
            {
                if (sum1 == sum2)
                    System.out.println( "All clear." );
                else
                    System.out.println( "No good." );
                       
            }
        
    }

  • #2
    Re: java phailing

    Originally posted by vinsai View Post
    when I run it with 'java md5Check' it doesn't return anything and just returns to BASH prompt.
    I'd advise you to get a book about basics of programming in Java. Bruce Eckel's Thinking in Java is said to be a good one. That being said, your program never calls input() nor verify() methods, so no output is ever generated.

    -vP

    Comment


    • #3
      Re: java phailing

      As vP stated, your main method is empty therefore your program doesn't do anything.

      As for textbooks, I found Thinking in Java to be very disappointing. When people ask me about Java books I always tell them that there's only 2 books they ever need get. Big Java (Horstmann) and Java in Easy Steps (aka 'Little Java' - McGrath). My reason for recommending Little Java is that it explains key topics in just enough detail to show you how to do what you want to do, without waffling on. Pair that with the detail that Big Java goes into, and you've got a good reference.
      Gareth Howells

      BSc (Hons), MBCS, MCP, MCDST, ICCE

      Any advice is given in good faith and without warranty.

      Please give reputation points if somebody has helped you.

      "For by now I could have stretched out my hand and struck you and your people with a plague that would have wiped you off the Earth." (Exodus 9:15) - I could kill you with my thumb.

      "Everything that lives and moves will be food for you." (Genesis 9:3) - For every animal you don't eat, I'm going to eat three.

      Comment


      • #4
        Re: java phailing

        I studied java a little bit a while back, and I'm trying to get back into it now. I feel like a tard, but thanks for the replies. I have Java: How to program (Deitel) 7th edition that they use to teach the java course at my university, but it's very dry, lots of squinting at large blocks of text and reading the same thing over and over to absorb it.

        Comment


        • #5
          Re: java phailing

          I used Objects First with Java: A Practical Introduction Using BlueJ (Barnes / Kolling) at university and found it to be a very good introduction to the language and OO in general. We also had Understanding Java (Cornelius) - a very poor book (according to the lecturers, as we agreed) - purely because it was written by one of the department tutors.

          BlueJ is a no-frills Java IDE that IMO is excellent for teaching Java. It's not so suitable for large projects, but is certainly very handy for dabbling with a concept.
          Gareth Howells

          BSc (Hons), MBCS, MCP, MCDST, ICCE

          Any advice is given in good faith and without warranty.

          Please give reputation points if somebody has helped you.

          "For by now I could have stretched out my hand and struck you and your people with a plague that would have wiped you off the Earth." (Exodus 9:15) - I could kill you with my thumb.

          "Everything that lives and moves will be food for you." (Genesis 9:3) - For every animal you don't eat, I'm going to eat three.

          Comment

          Working...
          X