New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

CSC 122 Lecture 0 and 1

by: AnnMarie

CSC 122 Lecture 0 and 1 CSC 122


GPA 3.028
View Full Document for 0 Karma

View Full Document


Unlock These Notes for FREE

Enter your email below and we will instantly email you these Notes for Intermed Computer Programming

(Limited time offer)

Unlock Notes

Already have a StudySoup account? Login here

Unlock FREE Class Notes

Enter your email below to receive Intermed Computer Programming notes

Everyone needs better class notes. Enter your email and we will send you notes for this class for free.

Unlock FREE notes

About this Document

I have created a PDF document of the first two lectures for CSC 122.
Intermed Computer Programming
Class Notes




Popular in Intermed Computer Programming

Popular in ComputerScienence

This 6 page Class Notes was uploaded by AnnMarie on Friday March 18, 2016. The Class Notes belongs to CSC 122 at Louisiana Tech University taught by MULMI, SANGAM in Spring 2016. Since its upload, it has received 27 views. For similar materials see Intermed Computer Programming in ComputerScienence at Louisiana Tech University.


Reviews for CSC 122 Lecture 0 and 1


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 03/18/16
March 16: CSC 122 Lecture 0 What are Variables? Variables store data. What are Preliminary Variables? int, double, char, byte, float, short, and long. How do you make a line comment? // How do you make a block comment? /** * */ What is white space? White space is used to make code understandable for the computer for privateint is not understandable and it also used to make code readable for the programmer and other programmers. What arithmetical operators in Java? +, -, *, /, % , ==, 1=, &&, <, >, >=, <=, &&, and II What is control flow within a program? The control flow of a program is the order in which individual statements, instructions, or function calls of an imperative program are executed or evaluated. What are conditional statements? if, if-else How many conditions can an if statement have? As many conditions you need. If you have multiple conditions the precedence determines which operation is performed first. What are ternary conditions? b = ( a == 1 ) ? 6 : 7; Aternary condition allows you to place an if-else statement into one line of code. The first part states the b is 6 if a is equal to 1 else b is 7. What is in a class? class – template for object. constructor – building instances correctly variables - state methods – behaviors What is a class variable and what is an instance variable? Aclass variable is for a specific variable for a class and an instance variable is a storage area for an object. What does a method return when it takes a parameter? You can return a value that is the same as the type that was declared in the method header. For example; public float c ( double b){ c = 10; return c; }. If you attempt to return any other type other than the declared type you will get an invalid return type error. What is iteration? Iteration is the repeated execution of a set of statements. How do you break or stop an iteration? You can use the break keyword and if you want to do something when a specific value is current you can use if-else statements with the continue and break keywords. What is object-orientation? Object-orientation is a software engineering concept, in which concepts are represented as “objects”. What are the major concepts of object-orientation? Encapsulation - information hiding Abstraction - breaking large problems into smaller problems Inheritance - Polymorphism - What is an array? What is a collection? An array is a collection that can store a fixed number of items.Acollection is a group of homogeneous (similar) objects. Can you store objects in an array? An array can store objects or primitive-type values. What is the difference between an array and an arrayList? arrayLists store objects and do not have a limit of how many objects that you can store.An array is used to store primitive values or objects and has a limit of how many values you can store in it. How to do you return the following string in reverse “This”? String a = “This”; String reverse = ““; for( int i = 0; i < a.(); i++){ reverse = s.charAt(i) + reverse; } return reverse; March 18: CSC 122 Lecture 1 What is inheritance in Java? Inheritance, in Java, is the concept of a general class that passes down properties to a specialized class. In other words, it allows us to define one class as an extension of another. What is a has-a relationship? We originally started learning about objects and how to use methods to make objects do things. We created classes that created objects and we can say that this is a has-a relationship bclasse a has a object. The following lines of code display a has-a relationship: Planet a = new Planet(); a = getName(); What is a is-a relationship? Earth is a planet – this is an example that we used in class to explain that the Planet class is the superclass and Earth is the subclass of Planet. Inheritance is often called an is-a relationship because a subclass is a specialization of a superclass. How do you use inheritance in Java? In Java, you will use the extends keyword to specify that this class is a subclass of the superclass. The following code segment illustrates this. class Earth extends Planet The class Planet is called the parent class or superclass – a class that is extended The class Earth is called the child class or subclass – a class that extends (inherits from) another class. The fields and methods from the superclass are inherited also when you declare a class to be a subclass of another class. Can you use multiple inheritance in Java? Java does not support multiple inheritance, but you can use inheritance hierarchy to simulate multiple inheritance. This multiple inheritance can be called inheritance hierarchy – classes that are linked through inheritance relationships. An example of this could be the classification of species used by biologists. The following diagram displays a small part of the inheritance hierarchy of animals. As you can see, the Tiger class is a subclass of Cat which is a subclass of Mammal which is the subclass ofAnimal. The principle is simple: inheritance is an abstraction technique that allows us to categorize classes of objects under certain criteria and helps us specify the characteristics of these classes. What is the purpose of access modifiers? Access modifiers such as - Public, Private , and Protected - allow access or deny access to variables and methods of one class from another class . Private variables and methods can only be accessed from within the class that they are declared. Public variables and methods can be accessed by other classes, but we do not make instance variables public. We allow methods to be public to allow other class to invoke actions on objects. The rules of privacy still apply to superclasses and subclasses because a subclass cannot access private members of its superclass. Protected allows only the predecessors of inheritance to access the variables. What are the properties of inheritance? 1. Sub-classes inheritance all the properties of the general class except Private access modifiers. 2. Sub-classes are specialized classes of the general class 3. Sub-classes have a is-a relationship with the general class. What is overriding? Overriding is the concept of taking a method that was inherited from the general class and changing it to have a different implementation. You can use the super. to implement a method that is in the general class once the method was overridden. It is suggested to put @override above the overridden method to make it known that you did the override on purpose. Why do you use inheritance? Inheritance provides several advantages such as – avoiding code duplication, code reuse, easier maintenance, and better (easier) extendibility. By using inheritance we can simplify a set of classes that have the same instance variables and methods instead of having lots of code duplication which makes it harder to maintain, harder to extend, and difficult to reuse. Do all the classes have constructors with class inheritance? Yes, a subclass needs to call the constructor of the superclass. The following displays how you would use the constructor of the superclass in the subclass. However, if you do not use the explicit call the constructor of the superclass, the compiler will do this automatically. But if the constructor of the superclass takes a parameter you have to explicitly call the constructor by super(parameter, parameter, ect.); else it will produce an error. class SolarSystem{ public SolarSystem(){ } } class Earth extends SolarSystem{ public Earth(){ super(); } } If you use a parameter with the super() when the general class constructor does not take a parameter, the class will not compile. After inheritance can you use a different type from the super type? Variables may hold objects of their declared type or of any subtype of their declared type.Asubtype is one that is defined by its subclass of a superclass. The following segment of code illustrates legal typing: SolarSystem s = new SolarSystem(); s = new Planet(); s = newAsteroids(); The type of a variable declares what it can store. Declaring a variable of type SolarSystem states that this variable can hold Planets andAsteroids because these are parts of a Solar System. “This principle is known as substitution. In object-oriented languages, we can substitute a subclass object where a superclass object is expected, because the subclass object is a special case of the superclass (page 294).” What is type casting? You can type cast to change the type of a variable or object with (type to change to) in order to force the compiler to compile. The following line of code displays an instance that you will want to use type casting because the complier will produce an error. SolarSystem s = new Planet() Planet p = s; // this will give an error You will will want to change the second line of code to Planet p = (Planet) s for this to work. However this is something to avoid unless necessary. But if you have to use type casting is is suggested to use the instanceof to check to see if the type you are changing to with the type casting is an object of that type. if(s instanceof Planet){ Planet p = (Plant) s;}


Buy Material

Are you sure you want to buy this material for

0 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Jim McGreen Ohio University

"Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."

Amaris Trozzo George Washington University

"I made $350 in just two days after posting my first study guide."

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"


"Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.