1 / 34

COMP248 Tutorial 1

COMP248 Tutorial 1. An Introduction to Computing Facilities and Java Basics. Computing Facilities. Tutorial Website http://users.encs.concordia.ca/~jo_chu/COMP248/ Tutorial Content - Examples to clarify the concepts in class; - Programming practice according to assignments;

jeneil
Télécharger la présentation

COMP248 Tutorial 1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. COMP248 Tutorial 1 An Introduction to Computing Facilities and Java Basics

  2. Computing Facilities • Tutorial Website http://users.encs.concordia.ca/~jo_chu/COMP248/ • Tutorial Content - Examples to clarify the concepts in class; - Programming practice according to assignments; - Questions from the class; • ENCS Account H-960 or EV 7.182 http://www.encs.concordia.ca/helpdesk/access.html

  3. Logging in • Make sure the machine runs the operating system that you want. You can work in Windows or in Linux.  If you prefer to work with Linux, refer to the “Tiny Unix tutorial” distributed in class. • If the machine is not running the OS that you want, re-boot it and select the right OS.  • Log in and change your password. http://www.encs.concordia.ca/helpdesk/access.html • Create a directory (or folder) in your home called comp248

  4. Java Installation http://www.oracle.com/technetwork/java/javase/downloads/index.html

  5. Eclipse Installation http://www.eclipse.org/downloads/

  6. Eclipse Installation • Install Eclipse: • Unlike most modern software products, Eclipse has not have a fancy installation procedure. To install it, simply extract the zip file in the directory where your programs are stored, e.g. C:\Program Files. This will create a directory named eclipse. The executable program file is located in this directory and is called "eclipse.exe". On Windows systems, it is a good idea to create a shortcut to this executable on your desktop. To do this, right-click on the "eclipse.exe" file and select "Send To → Desktop". • Initializing Eclipse: • Eclipse stores all its files in a directory called its "workspace". When Eclipse is run for the first time, it will ask you where you want the workspace to be placed. You can just use the default location (which will be in the directory where eclipse was installed). Some people find it more convenient to place the workspace somewhere in their "My Documents" directory, e.g. "My Documents\Eclipse". After this, you should see the "Welcome to Eclipse" page. When you see this, you are ready to proceed to the next step.

  7. Java Program Structure • even the main() function has to be defined in a class. • An instance of the class, which defines main(), will be the main class when run. • There should be only one public class with main in a file and the file name must be the same (including capitalization and spelling) as the main class’ name plus the .java extension. • In general: one (any) public class per file. It is possible to have more than one class defined within one .java file, but only one of them should be public and the file name should correspond to that, public, class name. • When a java program compiled with no errors with javac, a JVM object code is produced and stored in .class files. One file per class.

  8. Java Program Structure (2) • main() • Declaration:public static void main(String argv[]){ … } • The argv is a list of arguments passed via command line

  9. Compilation • 2 ways to compile and run a Java program • Using command line • Through a Development Editor like Eclipse

  10. Using Command Line • Write a Java program using any editor and save it as (*.java) file with the same name as the class. • Go to the directory where you created your program using DOS command. • To compile on a DOS command line: javac filename.java • To run on a DOS command line: java filename

  11. Compressing files

More Related