Prog

Subdecks (1)

Cards (27)

  • Welcome to our Programming 2 class!
  • SCHOOL OF INFORMATION TECHNOLOGY EDUCATION
  • Non-primitive data types in Java
    • Arrays
    • Strings
    • Classes
  • Non-primitive data types

    Also known as reference types, used to represent complex data structures and objects, created by the programmer, can hold multiple values of primitive data types or other reference types
  • Arrays
    • Collections of elements of the same data type
    • Have a fixed size determined at the time of creation
    • Elements can be accessed using their index
    • Index always starts at 0
  • Arrays
    • int[] numbers = new int[5]
    • int[] numbers = {1, 2, 3, 4, 5}
  • Commonly used array methods
    • length
    • clone()
    • equals(Object obj)
    • toString()
    • copyOf(int[] original, int newLength)
    • copyOfRange(int[] original, int from, int to)
    • fill(int[] array, int value)
    • sort(int[] array)
    • binarySearch(int[] array, int key)
    • hashCode()
    • asList(T... a)
    • stream()
  • Advantages of arrays
    • Provide a simple way to store and access a fixed number of elements
    • Offer direct access to elements using index, resulting in constant-time access
  • Disadvantages of arrays
    • Have a fixed size, making it challenging to resize dynamically
    • Do not provide built-in methods for common operations like adding or removing elements
  • Strings
    • Represent a sequence of characters
    • Immutable, meaning their values cannot be changed once created
    • Widely used for storing textual data
  • Strings

    • String message = "Hello, World!"
  • Commonly used string methods
    • charAt(int index)
    • length()
    • substring(int beginIndex)
    • substring(int beginIndex, int endIndex)
    • concat(String str)
    • toLowerCase()
    • toUpperCase()
    • trim()
    • equals(Object obj)
    • equalsIgnoreCase(String anotherString)
    • indexOf(int ch)
    • lastIndexOf(int ch)
    • contains(CharSequence s)
    • startsWith(String prefix)
    • endsWith(String suffix)
    • replace(char oldChar, char newChar)
    • split(String regex)
    • join(CharSequence delimiter, CharSequence... elements)
  • Advantages of strings

    • Immutable, ensuring thread safety and allowing for easy caching and reuse
    • Provide numerous utility methods for string manipulation, making them versatile
  • Disadvantages of strings

    • Immutable nature can lead to performance issues when frequent modifications are required, as each modification creates a new string object
  • Classes
    • Blueprints for creating objects
    • Encapsulate data for the object and define behavior through methods
    • Objects are instances of classes, representing real-world entities
  • Advantages of classes
    • Facilitate object-oriented programming, enabling encapsulation, inheritance, and polymorphism
    • Allow for modeling complex real-world entities with attributes and behaviors
  • Disadvantages of classes
    • Can introduce overhead due to memory allocation and method invocation
    • Improperly designed classes can lead to maintenance challenges and code complexity
  • The Universidad de Dagupan shall be known as an educational institute that discovers and develops God-given gifts to help achieve man's personal fulfillment and community uplift
  • We will continue to maintain our innovation efforts with the potential to create solutions and to be an invaluable national treasure
  • We shall commit to provide satisfactory service delivery and comply applicable requirements in view of the educational, scientific, and technical developments
  • We shall unceasingly improve our instruction, research, extension, and administrative operations to provide excellent education to individuals and to communities responsive to the challenges of the changing world
  • Core values
    • Competence
    • Unity
    • Integrity
    • Dedication
    • Teamwork
    • Dynamism