Results 1 to 5 of 5
Thread: compiler broken please help
- 10-10-2008, 04:47 AM #1
Member
- Join Date
- Oct 2008
- Posts
- 16
- Rep Power
- 0
compiler broken please help
My compiler is not working for some reason can someone please tell me the exact output of this code and show the values of the variables after each line executes. Thank you
Java Code:import java.util.*; import java.io.*; import javax.swing.JOptionPane; public class hwpra { static Scanner console = new Scanner(System.in); public static void main ( String[] args ) { int num1; IntClass num2; num1=0 num2= new IntClass(20); System.out.println("line 3: in main: num1= " + num1 + ", num2= " + num2.getNum()); funcOne(num1, num2); System.out.println("line 5: in main after funcOne: " + "num1 = " + num1 + ", num2 = " + num2.getNum()); } public static void funcOne (int a, IntClass b) { int x; int z; x = b.getNum(); z= a + x; System.out.println("line 8: in funcOne: a = " + a + ", b = " + b,getNum() + ", x = " + x + "' and z = " + z); x = x + 5; System.out.println("line 10: in funcOne: a = " + a + ", b = " + b,getNum() + ", x = " + x + "' and z = " + z); a = a + 8; b.setNum(a + x + z); System.out.println("line 10: in funcOne: a = " + a + ", b = " + b,getNum() + ", x = " + x + "' and z = " + z); } }
- 10-10-2008, 06:20 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Did you get any error messages at compile time?
- 10-10-2008, 06:31 AM #3
hhhmmm...
Compiler's broken? How is it broken or what's the error msg you get. BTW, the forum isn't going to answer you're questions (from both postings) for two reasons:
1) the forum doesn't do homework. If you have a specific question or problem about your code and you have shown that you have tried to work it out, then you will get help.
2) The shown program isn't complete. What does the intClass class do? It's not shown.
So... let's start with the compiler: how is it broken?
CJSL
-
I've heard some excuses in my day, but this one tops most.
- 10-10-2008, 07:47 AM #5
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Similar Threads
-
Classpath is broken after Ctrl+S
By vetalok in forum EclipseReplies: 2Last Post: 08-18-2008, 10:35 AM -
Imports broken in JSP; HTTP Status 500-
By Aerinai in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 06-13-2008, 10:27 PM -
Broken korean characters Urgent help needed!
By priyap3 in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 01-14-2008, 09:40 AM -
Asking for the compiler
By fernando in forum Other IDEsReplies: 1Last Post: 08-06-2007, 09:04 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks