Computer Science Canada
Programming C, C++, Java, PHP, Ruby, Turing, VB
Username:
Password:
Register
Wiki
Blog
Search
Turing
Chat Room
Members
Java functions/procedures/processes
Index
->
Programming, Java
->
Java Help
Author
Message
Finaltank
Posted:
Tue Oct 11, 2005 8:38 pm
Post subject: Java functions/procedures/processes
Ok as you probably see TONS of "Turing" examples ill just use Turing as my base lol...
Ex: In Turing you use
code:
procedure Name
// Statements
end Name
Then you call the procedure 'Name' later in the program to execute that section of code.
Can you do that in java?
Oh bad news, im using Ready To Program, meaning we learn stuff using consolse
Ex:
code:
// The "ClassNameHere" class.
import java.awt.*;
import hsa.Console;
public class ClassNameHere
{
static Console c; // The output console
public static void main (String[] args)
{
c = new Console ();
// Place your program here. 'c' is the output console
} // main method
} // ClassNameHere class
Though seeing the code in regular java would be nice
Sponsor
Sponsor
[Gandalf]
Posted:
Tue Oct 11, 2005 8:46 pm
Post subject: (No subject)
Yes, a procedure is a function that doesn't return anything.
code:
public static void sayHello ()
{
System.out.println("Hello!");
}
and a simple hello world program in normal Java is:
Java:
public
class
ClassName
{
public
static
void
main
(
String
[
]
args
)
{
System
.
out
.
println
(
"Hello World!"
)
;
}
}
Finaltank
Posted:
Tue Oct 11, 2005 9:07 pm
Post subject: (No subject)
How would I make it so I can use classes in other parts of the program?
Like
code:
Class Name
{
Stuff
}
// Later on
class Main
call up class 'Name'
}
[Gandalf]
Posted:
Tue Oct 11, 2005 9:12 pm
Post subject: (No subject)
I suggest reading the great introduction to Java tutorial by wtd:
http://www.compsci.ca/v2/viewtopic.php?t=9576
It has all you need to know and more
.
Martin
Posted:
Tue Oct 11, 2005 11:07 pm
Post subject: (No subject)
Here's a tutorial by the man.
http://java.sun.com/docs/books/tutorial/
Threads are basically lightweight processes. I wouldn't worry about them until you get the fundamentals of Java down first though.
Display posts from previous:
All Posts
1 Day
7 Days
2 Weeks
1 Month
3 Months
6 Months
1 Year
Oldest First
Newest First
Index
->
Programming, Java
->
Java Help
Page
1
of
1
[ 5 Posts ]
Jump to:
Select a forum
CompSci.ca
------------
- Network News
- General Discussion
General Forums
-----------------
- Hello World
- Featured Poll
- Contests
Contest Forums
-----------------
- DWITE
- [FP] Contest 2006/2008
- [FP] 2005/2006 Archive
- [FP] 2004/2005 Archive
- Off Topic
Lounges
---------
- User Lounge
- VIP Lounge
Programming
--------------
- General Programming
General Programming Forums
--------------------------------
- Functional Programming
- Logical Programming
- C
C
--
- C Help
- C Tutorials
- C Submissions
- C++
C++
----
- C++ Help
- C++ Tutorials
- C++ Submissions
- Java
Java
-----
- Java Help
- Java Tutorials
- Java Submissions
- Ruby
Ruby
-----
- Ruby Help
- Ruby Tutorials
- Ruby Submissions
- Turing
Turing
--------
- Turing Help
- Turing Tutorials
- Turing Submissions
- PHP
PHP
----
- PHP Help
- PHP Tutorials
- PHP Submissions
- Python
Python
--------
- Python Help
- Python Tutorials
- Python Submissions
- Visual Basic and Other Basics
VB
---
- Visual Basic Help
- Visual Basic Tutorials
- Visual Basic Submissions
Education
-----------
- Student Life
Graphics and Design
-----------------------
- Web Design
Web Design Forums
---------------------
- (X)HTML Help
- (X)HTML Tutorials
- Flash MX Help
- Flash MX Tutorials
- Graphics
Graphics Forums
------------------
- Photoshop Tutorials
- The Showroom
- 2D Graphics
- 3D Graphics
Teams
------
- dTeam Public
Style:
Appalachia
blueSilver
eMJay
subAppalachia
subBlue
subCanvas
subEmjay
subGrey
subSilver
subVereor
Search:
You can syndicate this boards posts using the file
backend.php
or view the
topic map using sitemap.php.
Terms of Use
|
Privacy Policy