Download presentation
Presentation is loading. Please wait.
Published byNathaniel Kennedy Modified over 9 years ago
1
Lab 1 Preparation UNIX/Linux background Java Language Intro
2
UNIX/Linux Background UNIX/Linux (*NIX) are operating systems – “Use small programs that are each good at one thing” – Multiuser – Become a desktop OS Why use it? – UNIX released in 1971 Legacy support for companies – “Windows rot” and stability – Multiuser and security
3
Linux in the Lab
4
Navigating *NIX Windows: Device based file system – C:\ hard drive, D:\ CD-ROM (for example) – You open the hardware you want, and then navigate folders *NIX: Mounting file system – / (root) and then directories. No direct notice of the devices – Multi-users Permissions Distinct file spaces
5
Navigating *NIX /home/smiller /home/smiller/stuff/more stuff/file.txt / RootDirectorySub-directory HOME DIRECTORY Sub-directory File Root
6
Navigating *NIX / / home smiller other bin *NIX C:\ Documents & Settings smiller other Program Files Windows My Documents
7
Permissions chmod filename will change the permission of each entity to a file/directory – Owner, Group, Others (everyone else) – Read with ls -l as 3-value sets or read, write and execute
8
Java Tutorial/Refresher Java structure Static variables Calling other classes (Intro to OOP)
9
Java Language Structure Packages - contain many related classes Classes – (generally) single.java files containing variables and methods – Encapsulates and object – Classes encapsulate lots of similar “work” in many methods Method – function; unit of code that “does work” on data stored in an object
10
Static Variables Static variables – Created at execution time for the program – Only available in scope where defined – Are never destroyed and therefore their values are always available until program termination Static methods can ONLY use static global variables The main method is static for this reason Keep in mind for JSP
11
Calling Classes A class has 4 main pieces – Class definition: name and type of class – Data: variables stored in class’ data structure – Methods: code that operates on the data in the class – Constructor or main(): This is the entry point to the class
12
Calling Classes Think of how you create other variables: String, int, etc. – int myVariable = 100; – Creates an object of type integer and allocated the memory (optionally initializes it) If you have a class to instantiate (create), you call it the same way – MyClass myVariable; – To initialize it: MyClass myVariable = new MyClass(arguments);
13
Calling Classes Much like classes you have used in CSC110, you call a method in a class with a ‘.’ MyClass myVariable; myVariable.doSomething(); System.out.print(“We did something”);
14
Classes and Java Java provides nearly any function you’d need to do common tasks (including networking) in provided classes. You need to create objects containing the functionality you need.
15
NEXT CLASS Object-Oriented Programming and finishing Networking slides Finish Lab 1 and be ready to submit it
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.