obj
is short for "object" and is a commonly used abbreviation in programming languages such as JavaScript, Python, and Java. It refers to a data structure that contains properties (variables) and methods (functions) that operate on those properties.
In JavaScript, an obj
could be defined like this:
let obj = {
name: "Alice",
age: 30,
greet: function() {
return "Hello, my name is " + this.name + " and I am " + this.age + " years old.";
}
};
In Python, an obj
could be defined like this:
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
def greet(self):
return "Hello, my name is " + self.name + " and I am " + str(self.age) + " years old."
obj = Person("Alice", 30)
In Java, an obj
could be defined like this:
public class Person {
String name;
int age;
public Person(String name, int age) {
this.name = name;
this.age = age;
}
public String greet() {
return "Hello, my name is " + this.name + " and I am " + this.age + " years old.";
}
}
Person obj = new Person("Alice", 30);
In all of these examples, obj
represents an instance of a person with properties (name and age) and a method (greet) that uses those properties to generate a greeting message.
Ne Demek sitesindeki bilgiler kullanıcılar vasıtasıyla veya otomatik oluşturulmuştur. Buradaki bilgilerin doğru olduğu garanti edilmez. Düzeltilmesi gereken bilgi olduğunu düşünüyorsanız bizimle iletişime geçiniz. Her türlü görüş, destek ve önerileriniz için iletisim@nedemek.page