Computer Support System

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Friday, 1 April 2011

The Structure of Java Code

Posted on 21:38 by Unknown

In the previous section, you tidied up your code a bit. Here's what your coding window should look like now:
First Java Project Code
You can see we have the package name first. Notice how the line ends with a semicolon. If you miss the semicolon out, the programme won't compile:
package firstproject;
The class name comes next:
public class FirstProject {
}
You can think of a class as a code segment. But you have to tell Java where code segments start and end. You do this with curly brackets. The start of a code segment is done with a left curly bracket { and is ended with a right curly bracket }. Anything inside of the left and right curly brackets belong to that code segment.
What's inside of the left and right curly brackets for the class is another code segment. This one:
public static void main( String[ ] args ) {

}
The word "main" is the important part here. Whenever a Java programme starts, it looks for a method called main. (A method is just a chunk of code. You'll learn more about these later.) It then executes any code within the curly brackets for main. You'll get error messages if you don't have a main method in your Java programmes. But as its name suggest, it is the main entry point for your programmes.
The blue parts before the word "main" can be ignored for now.
(If you're curious, however, public means that the method can be seen outside of this class; static means that you don't have to create a new object; and void means it doesn't return a value - it just gets on with it. The parts between the round brackets of main are something called command line arguments. Don't worry if you don't understand any of that, though.)
The important point to remember is that we have a class called FirstProject. This class contains a method called main. The two have their own sets of curly brackets. But the main chunk of code belongs to the class FirstProject.
In the next part, you'll learn how to run your Java programmes.
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in Blog, File Sharing, Free Articles, Java Programe, My Computer | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Clearing Hard Drive Space on Windows XP
    Windows XP was released way back in 2001, so what should you do when you’re running out of hard drive space for these 2009 programs? Clearin...
  • What to Look For When Purchasing a Mouse
    The mouse is probably the most essential part of many users experience with computers. Your mouse can affect the ease of browsing around the...
  • How To: Install Windows Mobile 6.5 Right Now
    The bad news:  Windows Mobile 6.5  won't be coming out for a while, and you'll be expected to buy a whole new phone to get it. The g...
  • Windows Explorer Keyboard Shortcut
    Windows Explorer keyboard shortcuts Press To END Display the bottom of the active window. HOME Display the top of the active window. NUM LOC...
  • Automate Windows Maintenance Tasks to Keep Your PC Running Like New
    With a Windows computer there are several maintenance tasks you should run on a regular basis, though most of us forget. Here’s how to autom...
  • Submit googleaddurl.com
    Google adds new sites to our index, and updates existing ones, every time we crawl the web. If you have a new URL, tell us about it here. We...
  • How to Delete Everything on Your Computer
    There are people who want to delete everything in their computer and want to start from scratch again. But the problem is that they do not k...
  • Blogspot vs Wordpress
    WordPress Vs. Blogger: Which Should You Choose for Your Professional Blog? You've made the decision to start a professional blog. Now yo...
  • How to make Elastomer (Botle)
    Material : A. Thermoplastic - Heated melt - Cooled → back to its original kesifat Example : Polyethylene , polypropylene , polyst...
  • Windows Keyboard Shortcut Overview
    General keyboard shortcuts Press To CTRL+C Copy. CTRL+X Cut. CTRL+V Paste. CTRL+Z Undo. DELETE Delete. SHIFT+DELETE Delete selected item per...

Categories

  • Access Media Collection
  • Add HTML facebook on site
  • addurl
  • Administration Tools
  • Adsense
  • Anatomy Virus
  • Animator
  • Anomymity
  • Anti Virus
  • Applications Install
  • BELAJAR PHOTOSHOP
  • Blog
  • Blufftop
  • CA-CLIPPER INTERNAL ERROR
  • Cannot Open Password
  • Celebs
  • Computer Desk
  • Computer Hang
  • Computer Icon
  • Computer Management
  • Computer Repair
  • Computer Set Up
  • Computer Tablet
  • Computer Touch Screen
  • Computer Troubleshooting
  • Cookies
  • Cookies Definitions
  • Crack
  • Create DVD
  • Create DVD Maker
  • Create PDF
  • Create PDF using Smart PDF Creator
  • D-Link
  • D-Link Router
  • Database Format
  • Definitions of Virus
  • Device
  • Device Manager
  • DNS
  • Doc Protect
  • Dongle USB
  • Drive partitions
  • Drive parts
  • Driver Printer HP
  • DVD compress
  • DVD Drive
  • Earn Money
  • Easy Gif Animator
  • Elastomer
  • Eror Format
  • Eror Solution
  • Error Computer
  • ERROR Solutions
  • Error windows explorer
  • External Hard Drive
  • Facebook
  • Facebook and Site
  • File Sharing
  • Football Game
  • Free Articles
  • Free Internet
  • Game Sport
  • Googel
  • Hack Password
  • Hard Drive
  • Hard Drive Partitioning
  • Healty
  • Help and Support
  • Help Support
  • Household Aplieance
  • How to
  • How to Download
  • HP Lapotop Reviews
  • Inside Adsense
  • intall
  • Intall Windows 7 Ultimates
  • Internet
  • Internet Browser
  • Internet Explore
  • Ipad
  • Java Programe
  • Java Script
  • JPEG JPG GIF PNG BMP
  • Keyboard
  • Keygen Smadav 8.7
  • Laptop
  • Laptop Computer Skin
  • Laptop vs PC
  • Life Style
  • Local Area Network
  • Maintanance and Repair
  • Make CD iso
  • Make DVD
  • Make Money with blog
  • Make Your Own Copy-Protected CD with Passive Protection
  • Messenger and Chat
  • Microsoft
  • Mobile Aplications
  • Mobile Phone
  • Modem
  • MotorSport
  • Ms Word Applications
  • MS Word to PDF
  • Ms Words
  • My Computer
  • Network Set Up
  • Networking
  • NVIDIA GeForce
  • Online Shoping
  • Operating System
  • Partitions drive
  • Password Wifi
  • PC Desktop
  • PDF EDITOR
  • PDF Remover
  • Photoshop
  • Picture
  • Prevent Windows XP
  • Print
  • Printer Error
  • Protect CD from Copy
  • Protect Password Folder
  • Protect Your Computer
  • Reboot Application
  • Remove Pasword Excel
  • Restore Windows Registry
  • Router
  • Search Engine Index
  • Search Engines Optimizer
  • Security
  • Security System
  • Shortcut
  • Smadav 8.7
  • Smart PDF Creator
  • Social Networking
  • software Protection
  • Solving Probelm
  • Startup Programs
  • SuperBike
  • System Registry
  • System Restore
  • Table Manager
  • Test DVD
  • Test DVD Drive
  • Troubleshooting all
  • Tutorial Java
  • TUTORIAL PHOTOSHOP
  • Upload File to blogger
  • Upload Files
  • USB Install
  • USB REMOVE
  • USB Repair
  • VGA Card
  • VGA Conector
  • VGA Informations
  • Virtual Memory is to Low
  • Virus
  • Viture Windows 7
  • Watermark
  • What is Cookies
  • Wifi
  • Wifi Pasword Finder
  • Win Pes2011
  • Windows
  • Windows Device
  • Windows DVD Maker
  • windows explorer cannot open
  • Windows Mobile
  • Wireless
  • Wireless router
  • Word Password Remover
  • words documents cannot open
  • Words error
  • XFBML and HTML Facebook

Blog Archive

  • ▼  2011 (70)
    • ►  November (24)
    • ►  September (3)
    • ►  August (2)
    • ►  May (1)
    • ▼  April (24)
      • How Computer Virus Works?
      • HP Laptop Reviews
      • Laptop Computer Skins
      • Computer Desk
      • How to Make a Touch Screen Laptop with Multiple Fi...
      • A "Social Networking Safety Act", Social Networking
      • A Free Internet, If We Can Keep It
      • There’s anonymity on the Internet. Get over it.
      • Make Your Own Copy-Protected CD with Passive Prote...
      • Windows 2000 DNS
      • Windows 2000 Access Management
      • Computer Management
      • How to Use Computer Management on the Local Computer
      • Computer Management
      • 7 Problems Solving Strategies
      • The NetBeans Software
      • Java Comments
      • The Structure of Java Code
      • Sharing your Java Programmes
      • How to Run Your Java Program
      • Printing to the Output Window
      • MEMBUAT EFEK PHOTO BOOTH PADA FOTO
      • MEMBUT GELEMBUNG DI PHOTOSHOP
      • MEMBUAT PATUNG DI PHOTOSHOP
    • ►  March (15)
    • ►  January (1)
  • ►  2010 (168)
    • ►  December (6)
    • ►  November (4)
    • ►  October (124)
    • ►  September (8)
    • ►  August (3)
    • ►  July (2)
    • ►  March (2)
    • ►  February (2)
    • ►  January (17)
Powered by Blogger.

About Me

Unknown
View my complete profile