Posts
Showing posts with the label java programming
Java Instance Final Variable | Core Java Bangla Tutorial #shorts #java #...
- Get link
- X
- Other Apps
এনক্যাপসুলেশন (Encapsulation) Object-Oriented Programming
- Get link
- X
- Other Apps
- Encapsulation হলো Object-Oriented Programming এর একটা গুরুত্বপূর্ণ concept। এটার মাধ্যমে class-এর data গুলোকে বাইরের access থেকে লুকানো হয়। যেমন – variable গুলোকে private রাখা হয়। তারপর সেই data access করার জন্য ব্যবহার করা হয় Getter আর Setter method। এর ফলে data হয় secure, code হয় easy to maintain, আর system পায় flexibility। public class Employee { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } } public class EmployeeMain { public static void main(String[] args) { Employee employee = new Employee(); employee.setName("Abdullah"); System.out.println("Name: "+ employee.getName()); } } output: Abdullah