CodeGym /Courses /New Java Syntax /Additional lessons for Level

Additional lessons for Level

New Java Syntax
Level 8 , Lesson 9
Available

In this level, you learned what primitive types Java has and how they are expanded and narrowed. We talked about objects and classes. What's more, we began to study what makes Java Java — the principles of object-oriented programming. Be patient a little longer: before you proceed to the next level, we recommend that you work through this lesson.

Principles of OOP

You already know how everything is organized in Java: you declare classes and create objects based on classes, classes have methods, etc. But why is it all like this and not otherwise? Why is the language structured so that programs consist of classes and objects, and not something else? Why was the concept of an "object" invented and put at the forefront? Are all languages designed this way? If not, what advantages does it give to Java? There are a lot of questions. This lesson will help you tackle them. You will dive deep into the principles of OOP: inheritance, abstraction, encapsulation, and polymorphism.


A lecture snippet with a mentor as part of the Codegym University course. Sign up for the full course.


Comments (2)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Benjamin Joseph Lentine Level 8, Songwon, South Korea
27 July 2024
Before watching the video, I tried my hand at creating that program. I wasn't too far off from his solution

import java.util.Scanner;

public class MessingAround {
    public static void main(String[] args) throws Exception {
        Scanner scanner = new Scanner(System.in);
        String query = scanner.next();
        query = query.toUpperCase();
        System.out.println(isPalindrome(query));
    }
    
    static boolean isPalindrome(String a){
        boolean maybe = true;
        for (int i = 0; i < a.length() / 2; i++) {
            if (a.charAt(i) != a.charAt(a.length() - (i + 1)))
                return false;
        }
        return true;
    }
}

Pavlo Level 13, Ilmenau, Germany
25 December 2022
Thanks for mentioning the efficiency. Love that part!