Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Malware / Trojaner / VirenRatHat Android Malware Uses AI to Target Banking Credentials in Real Time(22.09.2026 um 19:02 Uhr)
Malware / Trojaner / VirenIT Security News Hourly Summary 2026-09-22 19h : 10 posts(22.09.2026 um 19:00 Uhr)
IT Security NachrichtenCyberattack Hits University of Munich, Exposing Student Data(22.09.2026 um 19:02 Uhr)
IT Security NachrichtenGemini AI Autonomously Hacked 3 Companies, Google Confirms(22.09.2026 um 19:00 Uhr)
Malware / Trojaner / VirenRatHat Android Malware Uses AI to Target Banking Credentials in Real Time(22.09.2026 um 19:02 Uhr)
Malware / Trojaner / VirenIT Security News Hourly Summary 2026-09-22 19h : 10 posts(22.09.2026 um 19:00 Uhr)
IT Security NachrichtenCyberattack Hits University of Munich, Exposing Student Data(22.09.2026 um 19:02 Uhr)
IT Security NachrichtenGemini AI Autonomously Hacked 3 Companies, Google Confirms(22.09.2026 um 19:00 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

DAY : 19 How to use Encapsulation in java

Encapsulation Encapsulation is a Data protection In Java, encapsulation is a core object-oriented programming (OOP) principle that bundles data (variables) and the methods (functions) that operate on that data into a single unit, a…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

Encapsulation



Encapsulation is a Data protection



In Java, encapsulation is a core object-oriented programming (OOP) principle that bundles data (variables) and the methods (functions) that operate on that data into a single unit, a class, and restricts direct access to some of an object's components, promoting data hiding and controlled access



Image description



Access Modifier



Encapsulation is achieved through Access modifier



Image description



1.Private - within the same class

2.Default - Within the same package

3.Protection - Within the same package, inherited, class

4.Public - Public to the entire project



**All methods all called as method Signature*

Questions:

1.One can access non private fields and methods of a class (consider class A) from another class (Class B) - True

2.Can we have a Private main method - False

3.All Access Modifier applicable for local variables? - False

Class Example:




public class Google {

private int emp_salary;
public static String ho_address = "Mountain View";
public static boolean working = true;

private void get_user_details() {
int no = 10;
System.out.println("All Users Details");
}

public void search_Results() {
System.out.println("Searching Results");
}

}


public class User {
public static void main(String[] args) { //Method Signature
Google googleObj = new Google() ;
//System.out.println(googleObj.emp_salary);
System.out.println(Google.working);
System.out.println(Google.ho_address);

//googleObj.get_user_details();
googleObj.search_Results();
User.main();
}

public static void main(){
System.out.println("Overloaded Main Method");
}
}


Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten DAY : 19 How to use Encapsulation in java

Thematisch verwandte Begriffe: Encapsulation, java · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-94127 | When a BIG-IP APM access policy and an OAuth profile is configured on a …
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick