100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

CNIT 325 Questions and Answers Rated A+

Rating
-
Sold
-
Pages
11
Grade
A+
Uploaded on
30-01-2024
Written in
2023/2024

CNIT 325 Questions and Answers Rated A+ To compile: javac MyFirstP Will produce: MyFirstP To execute: java MyFirstProgram Java Class is a design construct, includes data (attributes) and behavior (methods) Object The living version of a class; "physical" version of the design construct class is like a house blueprint object is the house "Object is an instance of a class" Encapsulation "Data hiding" The idea of safeguarding data inside behavior. Access to the data is controlled by the behavior. In a class, we control the data using behavior (methods) Get methods Access the data within an object. Accessor methods (do not change the data) Set methods Update/set the data within an object. Mutator methods (mutate/change the data) Constructors how to initialize an object. Two types: default, user defined Default constructors Every class automatically has a constructor. For the person class, Person p = new Person(); , takes no arguments. Can be used if no other constructor is defined. Constructor Example Public class Person { public static void main(String [] args) { Person p = new Person(); //default constructor } } User defined constructors Can define as many as you want (within reason), default constructor goes away. takes no arguments or can take arguments. Example: Person p = new Person(18, "brown"); What is good design? Software is never finished, software is never perfect. Inheritance Class can inherit data and behavior from a parent class. Can be used to secure the data Access Modifiers Public Private Protected Package Inheritance Example (person class) (Gradstudent->Student->Person) public class Person { String PUID; String SSN; } public class Student { boolean attendGoldRush; double gpa; } public class GradStudent { boolean thesisComplete; } Public Available inside and outside the class Private Available only inside the class Protected Available inside the class and in the inheritance hierarchy Abstract Class Occurs as design becomes larger and the base class becomes more general. Abstract classes will never be instantiated. (Maybe Person will never be created, so we can make it an abstract class) Abstract Class Example (Person) public abstract class Person { .... public abstract String getSSN() {...} public abstract void setSSN(String s) {...} } Design hints Don't always use protected Use inheritance to model the "is a" relationship Place common operations in the superclass. Use polymorphism UTF-8 Most common for internet UTF-16 Used for Java Text Streams Text is the most common stream. In Text, 1234 is saved as "1234", in Binary, it is saved as 00 00 04 D2 To write text: PrintWriter out = new PrintWriter("", "UTF-8"); To save an object: out.WriteObject(person); XML Is NOT: A replacement for HTML A presentation format A programming language A network transfer protocol A database XML is: A meta markup language for textual documents/textual data Possible advantages of XML Truly portable data Easily readable by human users Very expressive Very flexible/customizable Easy to use from programs Easy to convert into other representations Many additional standards and tools Widely used and supported Document Markup Adds structural and semantic information to documents (e.g. Sections, subsections, theorems, cross references, index entries, named entities) (Abstract Windowing Toolkit) Introduced w/ java 1.0 Classes are divided into three main categories: graphics(colors, fonts, shapes), components(windows, buttons, menus), layout managers (control the positioning of components on screen) Swing With Java 2, swing classes were introduced. Many awt components have improved swing counterparts (AWT Button -> JButton). Swing does not replace awt. Component An abstract class Superclass of all gui components except menu components and class CheckBoxGroup Container The superclass for all components that contain other components defines add(), for adding components to a container Window A top level window with no border or menu bar Rarely instantiated (subclasses more useful) Frame A window with a title bar can have a menu bar top-level window for java AWT-based applications Panel A container that must be contained within another container Does not have its own window Applet A subclass of panel actually part of the t package, not awt AWT limitations Look & feel differs slightly across platforms, awt components limited to those that are available on all platforms (Lowest common denominator) Labels and Image icons Label is used to provide info to user or add decoration A Swing label is defined by the JLabel class It can incorporate an image defined by the ImageIcon class The alignment and relative positioning of the text and image of a label can be explicitly set Buttons Can fall into various categories: push button: generic button that initiates action Check box: a button that can be toggled on or off radio buttons: a set of buttons that provide mutually exclusive options(only one can be toggled at a time) Radio buttons are grouped using the ButtonGroup class Check boxes generate Item state changed events when toggled. Combo Boxes Displays a particular option with pull down menu from which user can choose a different option Combo box cannot be emptied unless it has something in it Creating a frame By default, frame is set to 0x0 pixels, setSize() is used. The show() message is sent to the frame to make it visible Border Layout Default for a frame Components layed out by this manager don't really get to have their preferred size Flow Layout Default for a panel Acts like a word processor, except w/ components instead of words Each component is the size it wants to be Laid out left to right, uses "word wrap" Box Layout Each component has its own size, components placed in order they are added, BUT can stack components vertically or horizontally (instead of automatic wrapping) Tool tips Provide a short pop up description when mouse cursor momentarily rests on a component Mneumonics Keyboard shortcuts that can be added to graphical objects

Show more Read less
Institution
CNIT 325
Course
CNIT 325









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
CNIT 325
Course
CNIT 325

Document information

Uploaded on
January 30, 2024
Number of pages
11
Written in
2023/2024
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
StellarScores Western Governers University
View profile
Follow You need to be logged in order to follow users or courses
Sold
1897
Member since
2 year
Number of followers
864
Documents
21000
Last sold
4 hours ago
Your Academic Hub: Documents, Study Guides, Summaries, Essays, and Exclusive Package Deals.

Welcome to my comprehensive academic resource store! At my online hub, I offer a vast array of meticulously crafted documents, study guides, summaries, and essays to support your educational journey. I understand the value of accuracy and completeness, which is why all my materials are verified and kept up-to-date with the latest versions. But that's not all! I also offer exclusive package deals and bundles to provide you with cost-effective solutions for your academic needs. Whether you're a student looking for study aids or seeking in-depth knowledge, my store is your one-stop destination for reliable, top-quality materials that can propel your learning experience to new heights. Explore my offerings and unlock the keys to academic success today!

Read more Read less
4.0

434 reviews

5
234
4
78
3
60
2
24
1
38

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions