{"id":279,"date":"2025-06-10T12:24:53","date_gmt":"2025-06-10T12:24:53","guid":{"rendered":"https:\/\/ntp.recruitmentdbranlu.in\/?p=279"},"modified":"2025-06-10T12:24:53","modified_gmt":"2025-06-10T12:24:53","slug":"how-to-create-relations-with-different-types-objects-of","status":"publish","type":"post","link":"https:\/\/www.reilsolar.com\/freepdf\/how-to-create-relations-with-different-types-objects-of\/","title":{"rendered":"How to create Relations with different types of Objects"},"content":{"rendered":"\n<p>This is an overview of my Protected Keywords Program this will help you to understand the concept very easily. Here i have created the different types of Packages for different functions.<\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<p>package p1;<\/p>\n<p>public class\u00a0 C1{<\/p>\n<p>\u00a0 public int x;<\/p>\n<p>\u00a0 protected int y;<\/p>\n<p>\u00a0 int z;<\/p>\n<p>\u00a0 protected void m();<\/p>\n<p>\u00a0 private int u;<\/p>\n<p>}<\/p>\n<\/td>\n<td>\n<p>package p1;<\/p>\n<p>public class\u00a0 C2{<\/p>\n<p>\u00a0 C1 o=new C1();<\/p>\n<p>\u00a0 o.x;\/\/?<\/p>\n<p>\u00a0 o.y;\/\/?<\/p>\n<p>\u00a0 o.z;\/\/?<\/p>\n<p>\u00a0 o.u;\/\/?<\/p>\n<p>\u00a0 o.m()\/\/?<\/p>\n<p>}<\/p>\n<\/td>\n<td>\n<p>package p1;<\/p>\n<p>public class\u00a0 C3 extends C1{<\/p>\n<p>\u00a0 status of x,y,z,u,and m()<\/p>\n<p>}<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>package p2;<br \/>public class\u00a0 C4 extends C1{<\/p>\n<p>\u00a0 status of x, y, z, u, and m()<\/p>\n<p>}<\/p>\n<\/td>\n<td>\n<p>package p2;<br \/>public class\u00a0 C5 {<\/p>\n<p>\u00a0 C1 o=new C1();<\/p>\n<p>\u00a0 status of x, y, z, u, and m()<\/p>\n<p>}<\/p>\n<\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>In this i have used the Overriding concept by using methods Overriding. The main use of this concept is to override the one with other.<\/p>\n<p>class Homer {<\/p>\n<p>char doh(char c) {<\/p>\n<p>System.out.print(&#8220;doh(char)&#8221;);<\/p>\n<p>return \u2018d\u2019;}<\/p>\n<p>float doh(float f) {<\/p>\n<p>System.out.print(&#8220;doh(float)&#8221;);<\/p>\n<p>return 1.0f; }}<\/p>\n<p>class Milhouse {}<\/p>\n<p>class Bart extends Homer {<\/p>\n<p>void doh(Milhouse m) {<\/p>\n<p>System.out.print(&#8220;doh(Milhouse)&#8221;);}}<\/p>\n<p>public class Hide {<\/p>\n<p>public static void main(String[] args) {<\/p>\n<p>Bart b = new Bart();<\/p>\n<p>b.doh(1);<\/p>\n<p>b.doh(\u2018x\u2019);<\/p>\n<p>b.doh(1.0f);<\/p>\n<p>b.doh(new Milhouse());}}`<\/p>\n<p>class Customer{<\/p>\n<p>\u00a0 private int cid;<\/p>\n<p>\u00a0 private static int counter =1000;<\/p>\n<p>\u00a0 public Customer(){cid=++counter; }<\/p>\n<p>\u00a0 public void displayCust(){<\/p>\n<p>\u00a0 System.out.println(\u201cCustid :\u201d +cid);}<\/p>\n<p>\u00a0 }<\/p>\n<p>class RegCustomer extends Customer{<\/p>\n<p>\u00a0 private float dis;<\/p>\n<p>\u00a0 public RegCustomer(float x){ dis=x; }<\/p>\n<p>\u00a0 public void displayCust(){<\/p>\n<p>\u00a0 System.out.println(\u201cDiscount :\u201d +dis); }<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p>class PriCustomer extends Customer{<\/p>\n<p>\u00a0 private String as;<\/p>\n<p>\u00a0 public PriCustomer(String x){ as=x; }<\/p>\n<p>\u00a0 public void displayCust(){<\/p>\n<p>\u00a0 System.out.println(\u201cMeme :\u201d +as);}<\/p>\n<p>}<\/p>\n<p>class Retail{<\/p>\n<p>\u00a0 public static void main(String [] args){<\/p>\n<p>\u00a0 RegCustomer rc=new RegCustomer(10.5f);<\/p>\n<p>\u00a0 PriCustomer pc=new PriCustomer(\u201cGold\u201d);<\/p>\n<p>\u00a0 rc.displayCust(); pc.displayCust();<\/p>\n<p>\u00a0 }<\/p>\n<p>}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is an overview of my Protected Keywords Program this will help you to understand the concept very easily. Here i have created the different types of Packages for different functions. package p1; public class\u00a0 C1{ \u00a0 public int x; \u00a0 protected int y; \u00a0 int z; \u00a0 protected void m(); \u00a0 private int u; [&hellip;]<\/p>\n","protected":false},"author":86,"featured_media":280,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38],"tags":[],"class_list":["post-279","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/www.reilsolar.com\/freepdf\/wp-json\/wp\/v2\/posts\/279","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.reilsolar.com\/freepdf\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.reilsolar.com\/freepdf\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.reilsolar.com\/freepdf\/wp-json\/wp\/v2\/users\/86"}],"replies":[{"embeddable":true,"href":"https:\/\/www.reilsolar.com\/freepdf\/wp-json\/wp\/v2\/comments?post=279"}],"version-history":[{"count":0,"href":"https:\/\/www.reilsolar.com\/freepdf\/wp-json\/wp\/v2\/posts\/279\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.reilsolar.com\/freepdf\/wp-json\/wp\/v2\/media\/280"}],"wp:attachment":[{"href":"https:\/\/www.reilsolar.com\/freepdf\/wp-json\/wp\/v2\/media?parent=279"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.reilsolar.com\/freepdf\/wp-json\/wp\/v2\/categories?post=279"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.reilsolar.com\/freepdf\/wp-json\/wp\/v2\/tags?post=279"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}