New Posts  All Forums:Forum Nav:

JAVA Noob needs help

post #1 of 8
Thread Starter 
What do the following mean and why are they there:

Import java.awt.graphics (whats with the dots?)

java.lang.Object (is this extend only?)

public static void main(String[] args)(what the heck is this????)

;

Also is there a basic way to use other classes? thank you!!!
post #2 of 8
You use dots in the imports so that you can import classes, like the Graphics class you want to import in the first statement. And Import should be spelled import. Java is case-sensitive.

public static void main(String [] args) lets you "run" a class to create output. So if I wanted to print "Hello, world!" to the screen, I would need a main() method so that I could output it.
Burning Phoenix
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel Q9550 Gigabyte EP45-UD3P eVGA GTX 260 Core 216 SuperClocked 4GB G.Skill DDR2-1000 5-5-5-15 
Hard DriveOptical DriveOSMonitor
3 WD 80GB RAID0, Seagate 500GB, WD 1TB Caviar BLCK Lite-On LH-20A1S Windoze 7 Professional Dual Dell E207WFP 20.1" Widescreen LCD's 
KeyboardPowerCaseMouse
Logitech G15 Silverstone OP750 Lian-Li PC-A10B Logitech G5 
Mouse Pad
Harley Davidson 
  hide details  
Reply
Burning Phoenix
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel Q9550 Gigabyte EP45-UD3P eVGA GTX 260 Core 216 SuperClocked 4GB G.Skill DDR2-1000 5-5-5-15 
Hard DriveOptical DriveOSMonitor
3 WD 80GB RAID0, Seagate 500GB, WD 1TB Caviar BLCK Lite-On LH-20A1S Windoze 7 Professional Dual Dell E207WFP 20.1" Widescreen LCD's 
KeyboardPowerCaseMouse
Logitech G15 Silverstone OP750 Lian-Li PC-A10B Logitech G5 
Mouse Pad
Harley Davidson 
  hide details  
Reply
post #3 of 8
Thread Starter 
what would happen if public static..etc wasn't there?

when you said main() inside the parenthesis would be sting [] args?

also are you explaining import or what the dots are for?

for the brackets{1
{2
2}
1}
is 2 the end of the program or can you place other programs inside the 1 brackets?
post #4 of 8
If I wanted to put static methods in my class, I would put them after the closing 2} brace and before the 1} brace if I had a main() method.

So it would go like this:
public class HelloWorld
{
public static void main(String [] args)
{
//stuff in the main method goes here, like System.out.println("Hello, world!");
}

public static void someMethod()
{
//doStuff;
}
}
Burning Phoenix
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel Q9550 Gigabyte EP45-UD3P eVGA GTX 260 Core 216 SuperClocked 4GB G.Skill DDR2-1000 5-5-5-15 
Hard DriveOptical DriveOSMonitor
3 WD 80GB RAID0, Seagate 500GB, WD 1TB Caviar BLCK Lite-On LH-20A1S Windoze 7 Professional Dual Dell E207WFP 20.1" Widescreen LCD's 
KeyboardPowerCaseMouse
Logitech G15 Silverstone OP750 Lian-Li PC-A10B Logitech G5 
Mouse Pad
Harley Davidson 
  hide details  
Reply
Burning Phoenix
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel Q9550 Gigabyte EP45-UD3P eVGA GTX 260 Core 216 SuperClocked 4GB G.Skill DDR2-1000 5-5-5-15 
Hard DriveOptical DriveOSMonitor
3 WD 80GB RAID0, Seagate 500GB, WD 1TB Caviar BLCK Lite-On LH-20A1S Windoze 7 Professional Dual Dell E207WFP 20.1" Widescreen LCD's 
KeyboardPowerCaseMouse
Logitech G15 Silverstone OP750 Lian-Li PC-A10B Logitech G5 
Mouse Pad
Harley Davidson 
  hide details  
Reply
post #5 of 8
Thread Starter 
Ty!
post #6 of 8
hey thats similar to C++. maybe i should learn java, is it easier than C++? cause i already know that language pretty well except GUI stuff.
    
CPUMotherboardGraphicsRAM
Intel C2D e6400 GIGABYTE GA965P-S3 nVidia GeForce 7600GT 1 GB DDR 800 OCZ Gold 
Hard DriveOptical DriveOSMonitor
160GB WD DVD+-RW XP-games+Gentoo-programmin 21' Sun CRT (pwns LCD) 
KeyboardPowerCaseMouse
Regular PS/2 "Quietkey" 680WEchoStar+500Wforfans Uber-modded SuperTower(got for $16!)dual PSU+LEDs USB Optical Dell *ewww, dell* 
Mouse Pad
"ALGOR" POS 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
Intel C2D e6400 GIGABYTE GA965P-S3 nVidia GeForce 7600GT 1 GB DDR 800 OCZ Gold 
Hard DriveOptical DriveOSMonitor
160GB WD DVD+-RW XP-games+Gentoo-programmin 21' Sun CRT (pwns LCD) 
KeyboardPowerCaseMouse
Regular PS/2 "Quietkey" 680WEchoStar+500Wforfans Uber-modded SuperTower(got for $16!)dual PSU+LEDs USB Optical Dell *ewww, dell* 
Mouse Pad
"ALGOR" POS 
  hide details  
Reply
post #7 of 8
C++ and Java are close syntactically, but they differ slightly...Do you want me to explain what the differences are or is that good enough?
Burning Phoenix
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel Q9550 Gigabyte EP45-UD3P eVGA GTX 260 Core 216 SuperClocked 4GB G.Skill DDR2-1000 5-5-5-15 
Hard DriveOptical DriveOSMonitor
3 WD 80GB RAID0, Seagate 500GB, WD 1TB Caviar BLCK Lite-On LH-20A1S Windoze 7 Professional Dual Dell E207WFP 20.1" Widescreen LCD's 
KeyboardPowerCaseMouse
Logitech G15 Silverstone OP750 Lian-Li PC-A10B Logitech G5 
Mouse Pad
Harley Davidson 
  hide details  
Reply
Burning Phoenix
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel Q9550 Gigabyte EP45-UD3P eVGA GTX 260 Core 216 SuperClocked 4GB G.Skill DDR2-1000 5-5-5-15 
Hard DriveOptical DriveOSMonitor
3 WD 80GB RAID0, Seagate 500GB, WD 1TB Caviar BLCK Lite-On LH-20A1S Windoze 7 Professional Dual Dell E207WFP 20.1" Widescreen LCD's 
KeyboardPowerCaseMouse
Logitech G15 Silverstone OP750 Lian-Li PC-A10B Logitech G5 
Mouse Pad
Harley Davidson 
  hide details  
Reply
post #8 of 8
Don't worry really about what (sting [] args) means, once you move into more advance stuff and into Object Oriented Programing you'll understand.
Quote:
Originally Posted by Modex
also are you explaining import or what the dots are for?
Both, the dots are used for importing. Are if you wanted everything say in the utilities class then its like java.util.*
Or if I only wanted the Scanner class out of Utilities: java.util.Scanner
BlackMesa
(14 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II x6 Gigabyte XFX RF460 16gb G.Skill 
Hard DriveHard DriveOSMonitor
OCZ Vertex2 Sata II Coorsair Force GS Sata III Debian (testing) Shimian 27" 
KeyboardMouse
Filco w/ blue cherries Who needs a mouse? 
  hide details  
Reply
BlackMesa
(14 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II x6 Gigabyte XFX RF460 16gb G.Skill 
Hard DriveHard DriveOSMonitor
OCZ Vertex2 Sata II Coorsair Force GS Sata III Debian (testing) Shimian 27" 
KeyboardMouse
Filco w/ blue cherries Who needs a mouse? 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming