Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Java student, super newb, totally stumped. Compile, no errors. Run shows nothing.

  1. #1
    Junior Member
    Join Date
    Jan 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Java student, super newb, totally stumped. Compile, no errors. Run shows nothing.

    Greetings,

    I am a student just starting to learn some basic Java programming and am totally stumped. I'm not even sure it's an issue with my code but I don't understand Java well enough to guess what else it might be, so I apologize if it is not my code and therefore this is the wrong forum.

    Assignment is write a program that will produce the data as it shows in our book. Instructor asked that we submit one program for all the assigned "problems".
    Using jGrasp, when I compile my code as below, it comes back as "operation complete" and shows no errors. So I run the thing to see if everything shows as it's supposed to and it gives the same "operation complete" message as I get when I compile and doesn't show any output. I didn't change any settings in jGrasp and it was working before, showing the output when I would run something. Hopefully, I'm making sense. Thank you for your time.

    public class TE1_ah_ah {
     
    	public static void main (String[] args) {
    	}
    		public static void victry() {
    			System.out.println("////////////////////");
    			System.out.println("||Victory is mine!||");
    			System.out.println("\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\");	
    		}
     
     
    		public static void spikes() {
    			System.out.println("\\/");
    			System.out.println("\\\\//");
    			System.out.println("\\\\\\///");
    			System.out.println("///\\\\\\");
    			System.out.println("//\\\\");
    			System.out.println("/\\");
    		}
     
     
    		public static void difference() {
             System.out.println("What is the difference between \n a ‘ and a \"? Or between a \" and a \\\"? \n \nOne is what we see when we’re typing our program. \nThen other is what appears on the \' console.\" ");
    		}
     
     
    		public static void egg() {
    			System.out.println("  _______");
    			System.out.println(" /       \\");
    			System.out.println("/         \\");
    			System.out.println("-\"-'-\"-'-\"-");
    			System.out.println("\\         /");
    			System.out.println(" \\_______/");
    		}
     
    		public static void eggs() {
    			drawTop();
    			drawBottom();
    			drawCrack();
    			drawTop();	
    			drawBottom();
    			drawCrack();	
    			drawBottom();
    			drawTop();
    			drawCrack();	
    			drawBottom();
    		}
     
    		public static void drawTop() {
    			System.out.println("  _______");
    			System.out.println(" /       \\");
    			System.out.println("/         \\");
    		}
     
    		public static void drawCrack() {
    			System.out.println("-\"-'-\"-'-\"-");
    		}
     
    		public static void drawBottom() {		
    			System.out.println("\\         /");
    			System.out.println(" \\_______/");	
    		}
     
     
    		public static void starFigures() {
    			drawRowsX();
    			System.out.println();
    			drawRowsX();
    			drawRows();
    			System.out.println();
    			drawStack();
    			drawRowsX();
    		}
     
    		public static void drawRowsX() {
    			drawRows();
    			System.out.println(" * * ");
    			System.out.println("  *  ");
    			System.out.println(" * * ");
    		}
     
    		public static void drawRows() {
    			System.out.println("*****");
    			System.out.println("*****");
    		}
     
    		public static void drawStack() {
    			System.out.println("  *  ");	
    			System.out.println("  *  ");
    			System.out.println("  *  ");
    		}
     
     
     
    }
    Last edited by helloworld922; January 7th, 2011 at 09:16 PM.


  2. #2
    Junior Member
    Join Date
    Dec 2010
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Java student, super newb, totally stumped. Compile, no errors. Run shows nothing.

    your code is really messed up. first of all u have created so many objects but none logical printouts. Please read some info about this b4 creating smth.

  3. #3
    Forum Squatter newbie's Avatar
    Join Date
    Nov 2010
    Location
    North Wales
    Posts
    661
    My Mood
    Stressed
    Thanks
    28
    Thanked 115 Times in 106 Posts
    Blog Entries
    1

    Default Re: Java student, super newb, totally stumped. Compile, no errors. Run shows nothing.

    public class TE1_ah_ah {
     
        //Only whats in the MAIN method will be run
        public static void main(String[] args) {
            spikes(); //this will print out whats defined in the spikes method
     
            //to print victry contents, simply type victry(); uncommented etc etc
        }
     
        public static void victry() {
            System.out.println("////////////////////");
            System.out.println("||Victory is mine!||");
            System.out.println("\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\");
        }
     
        public static void spikes() {
            System.out.println("\\/");
            System.out.println("\\\\//");
            System.out.println("\\\\\\///");
            System.out.println("///\\\\\\");
            System.out.println("//\\\\");
            System.out.println("/\\");
        }
     
        public static void difference() {
            System.out.println("What is the difference between \n a ‘ and a \"? Or between a \" and a \\\"? \n \nOne is what we see when we’re typing our program. \nThen other is what appears on the \' console.\" ");
        }
     
        public static void egg() {
            System.out.println(" _______");
            System.out.println(" / \\");
            System.out.println("/ \\");
            System.out.println("-\"-'-\"-'-\"-");
            System.out.println("\\ /");
            System.out.println(" \\_______/");
        }
     
        public static void eggs() {
            drawTop();
            drawBottom();
            drawCrack();
            drawTop();
            drawBottom();
            drawCrack();
            drawBottom();
            drawTop();
            drawCrack();
            drawBottom();
        }
     
        public static void drawTop() {
            System.out.println(" _______");
            System.out.println(" / \\");
            System.out.println("/ \\");
        }
     
        public static void drawCrack() {
            System.out.println("-\"-'-\"-'-\"-");
        }
     
        public static void drawBottom() {
            System.out.println("\\ /");
            System.out.println(" \\_______/");
        }
     
        public static void starFigures() {
            drawRowsX();
            System.out.println();
            drawRowsX();
            drawRows();
            System.out.println();
            drawStack();
            drawRowsX();
        }
     
        public static void drawRowsX() {
            drawRows();
            System.out.println(" * * ");
            System.out.println(" * ");
            System.out.println(" * * ");
        }
     
        public static void drawRows() {
            System.out.println("*****");
            System.out.println("*****");
        }
     
        public static void drawStack() {
            System.out.println(" * ");
            System.out.println(" * ");
            System.out.println(" * ");
        }
    }
    When you post in the future, use tags to make the code readable.

    Your code is fine, the reason you had no output was because you didn't specify anything to be printed.

    The 'main' method of a class is what gives you results, and as it was empty, the program would run and end without displaying anything.

    I've put an example back into your code which will print the contents of your spikes() method.

    I suggest you read up more on Java before attempting any more programs as it will help you greatly.
    Oracle offer a great tutorial:
    The Java™ Tutorials
    Last edited by newbie; January 7th, 2011 at 09:28 PM.

Similar Threads

  1. Replies: 10
    Last Post: September 6th, 2010, 04:48 PM
  2. [SOLVED] help in java i cant compile this
    By timeline in forum What's Wrong With My Code?
    Replies: 5
    Last Post: April 15th, 2010, 02:11 PM
  3. Totally stuck on this assignment
    By Sgiahatch in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 25th, 2010, 04:25 PM
  4. Student TreeMap
    By raphytaffy in forum Algorithms & Recursion
    Replies: 6
    Last Post: March 2nd, 2010, 12:11 AM
  5. help a newb
    By WahLao in forum Java Theory & Questions
    Replies: 1
    Last Post: January 4th, 2010, 02:13 PM