Results 1 to 8 of 8
Thread: input method help?
- 03-12-2010, 01:39 PM #1
Member
- Join Date
- Mar 2010
- Posts
- 8
- Rep Power
- 0
- 03-12-2010, 01:47 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,392
- Blog Entries
- 7
- Rep Power
- 17
-
- 03-12-2010, 02:19 PM #4
Member
- Join Date
- Mar 2010
- Posts
- 8
- Rep Power
- 0
Sorry i'm kinda stupid since i'm a beginner but what is "scanner"? :D , It's not an assignment :D, i saw my teacher's example code and i want to write a program that is similar to it (since i fall way behind in my class), this is my teachers code:
But if you can explain to me how those red lines work then nevermind the assignment :D Thanks. please excuse my stupidityJava Code:[COLOR="Green"]import javax.swing.*; public class Calculation{ public static void main(String []args){ [COLOR="Red"]new Calculation()[/COLOR]; } public Calculation(){ Cube c= new Cube(); int i=5; [COLOR="Red"] int squareIt = c.square(i);[/COLOR] System.out.println(squareIt); [COLOR="Red"]int cubeIt = c.cube(i);[/COLOR] System.out.println(cubeIt); } } class Cube{ public Cube(){} [COLOR="Red"]public int square(int i)[/COLOR]{ return i*i; } [COLOR="Red"] public int cube(int i)[/COLOR]{ return i*i*i; [/COLOR]} }Last edited by blazinhieu; 03-12-2010 at 02:32 PM.
-
Please edit your code above to use code tags. My signature below will explain this.
- 03-12-2010, 02:28 PM #6
Member
- Join Date
- Mar 2010
- Posts
- 8
- Rep Power
- 0
sorry ok i fixed it :D
-
What you're asking is how to call methods and constructors in Java, and the way to learn this is through your text books and notes. If you haven't found the Sun tutorials, please have a look as it will explain this better than any of us can:
Trail: Learning the Java Language (The Java™ Tutorials)
Best of luck!
- 03-12-2010, 03:07 PM #8
Member
- Join Date
- Mar 2010
- Posts
- 8
- Rep Power
- 0
Similar Threads
-
standard input stream storing to a generic method?
By vendetta in forum New To JavaReplies: 3Last Post: 01-29-2010, 08:13 PM -
More than one input in one private method
By rice in forum New To JavaReplies: 0Last Post: 10-02-2009, 05:08 AM -
How to remove “Input method” submenu selection from StyledText context menu?
By Mitja in forum SWT / JFaceReplies: 0Last Post: 09-21-2009, 11:33 AM -
Input parameter of Main method
By Java Tip in forum Java TipReplies: 1Last Post: 07-12-2008, 06:24 PM -
how to take input and verify input in Java programs
By bilal_ali_java in forum Advanced JavaReplies: 0Last Post: 07-21-2007, 08:46 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks