File tree Expand file tree Collapse file tree 14 files changed +320
-0
lines changed
Expand file tree Collapse file tree 14 files changed +320
-0
lines changed Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <classpath >
3+ <classpathentry kind =" src" path =" src" />
4+ <classpathentry kind =" con" path =" org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8" />
5+ <classpathentry kind =" output" path =" bin" />
6+ </classpath >
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <projectDescription >
3+ <name >Amnahjava</name >
4+ <comment ></comment >
5+ <projects >
6+ </projects >
7+ <buildSpec >
8+ <buildCommand >
9+ <name >org.eclipse.jdt.core.javabuilder</name >
10+ <arguments >
11+ </arguments >
12+ </buildCommand >
13+ </buildSpec >
14+ <natures >
15+ <nature >org.eclipse.jdt.core.javanature</nature >
16+ </natures >
17+ </projectDescription >
Original file line number Diff line number Diff line change 1+ eclipse.preferences.version =1
2+ org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode =enabled
3+ org.eclipse.jdt.core.compiler.codegen.targetPlatform =1.8
4+ org.eclipse.jdt.core.compiler.codegen.unusedLocal =preserve
5+ org.eclipse.jdt.core.compiler.compliance =1.8
6+ org.eclipse.jdt.core.compiler.debug.lineNumber =generate
7+ org.eclipse.jdt.core.compiler.debug.localVariable =generate
8+ org.eclipse.jdt.core.compiler.debug.sourceFile =generate
9+ org.eclipse.jdt.core.compiler.problem.assertIdentifier =error
10+ org.eclipse.jdt.core.compiler.problem.enumIdentifier =error
11+ org.eclipse.jdt.core.compiler.source =1.8
Original file line number Diff line number Diff line change 1+ /com /
Original file line number Diff line number Diff line change 1+ package com .java .basics ;
2+
3+ /* Name of the class has to be "Main" only if the class is public. */
4+ public class objExample {
5+ int i =9 ;
6+ public static void main (String [] args ) {
7+ objExample obj = new objExample ();
8+ obj .add (276 , 3 );
9+ int sub = sub (276 , 3 );
10+ double div = div (25 , 5 );
11+ float mult = obj .mult (5 , 5 );
12+ System .out .println (sub );
13+ System .out .println (mult );
14+ System .out .println (div );
15+
16+ if (obj .compare (6 ,8 ))
17+ {
18+ System .out .println ("b is greater than a" );
19+ }
20+ else
21+ {
22+ System .out .println ("a is greater than b" );
23+ }
24+ obj .compare (8 , 6 );
25+ }
26+
27+ private void add (int i , int j ) {
28+ System .out .println (i + j );
29+
30+ }
31+
32+ private static int sub (int i , int j )
33+ {
34+ return i - j ;
35+ }
36+
37+ private static double div (int i , int j ) {
38+ return i / j ;
39+ }
40+
41+ private float mult (float i , float j )
42+ {
43+ return i * j ;
44+ }
45+
46+ private boolean compare (int i , int j )
47+ {
48+ if (i > j ) {
49+ return true ;
50+ } else
51+ return false ;
52+ }
53+ }
Original file line number Diff line number Diff line change 1+ package com .objexample .encapsulation ;
2+
3+ public class Customer
4+ {
5+ private int product ;
6+ private String name ;
7+ private float total ;
8+ private String Address ;
9+ private long phone_number ;
10+ public int getProduct () {
11+ return product ;
12+ }
13+ public void setProduct (int product ) {
14+ this .product = product ;
15+ }
16+ public String getName () {
17+ return name ;
18+ }
19+ public void setName (String name ) {
20+ this .name = name ;
21+ }
22+ public float getTotal () {
23+ return total ;
24+ }
25+ public void setTotal (float total ) {
26+ this .total = total ;
27+ }
28+ public String getAddress () {
29+ return Address ; }
30+ public void setAddress (String address ) {
31+ this .Address = address ;
32+ }
33+ public long getPhone_number () {
34+ return phone_number ;
35+ }
36+ public void setPhone_number (long phone_number ) {
37+ this .phone_number = phone_number ;
38+ }
39+
40+
41+
42+ }
43+
Original file line number Diff line number Diff line change 1+ package com .objexample .encapsulation ;
2+
3+ public class Customer_details {
4+ public static void main (String [] args ) {
5+ Customer amnah = new Customer ();
6+ amnah .setAddress ("BTM" );
7+ amnah .setProduct (3 );
8+ amnah .setName ("big bazaar" );
9+ amnah .setTotal (345 );
10+ amnah .setPhone_number (1234567890 );
11+ System .out .println (amnah .getAddress ());
12+ System .out .println (amnah .getProduct ());
13+ System .out .println (amnah .getName ());
14+ System .out .println (amnah .getTotal ());
15+ System .out .println (amnah .getPhone_number ());
16+ }
17+
18+ }
Original file line number Diff line number Diff line change 1+ package com .objexample .encapsulation ;
2+
3+ public class Overloading {
4+ public static void main (String [] args )
5+ {
6+ Overloading obj =new Overloading ();
7+ obj .sub (12 );
8+ obj .sub (23.33f );
9+ obj .sub (43 , 23.33f );
10+ obj .sub (322 , 32 , 23 );
11+ obj .sub (12 , 22.332 );
12+ obj .sub (323.32 , 21 );
13+
14+ }
15+ private void sub (double d , int d2 )
16+ {
17+ System .out .println (d +d2 );
18+ }
19+ private void sub (int i , double d )
20+ {
21+ System .out .println (i +d );
22+
23+ }
24+ private void sub (int i , int j , int k ) {
25+ System .out .println (i +j +k );
26+ }
27+ private void sub (int i , float f )
28+ {
29+ System .out .println (i +f );
30+ }
31+ private void sub (float f )
32+ {
33+ System .out .println (f );
34+ }
35+ private void sub (int i )
36+ {
37+ System .out .println (i );
38+ }
39+
40+ }
Original file line number Diff line number Diff line change 1+ package com .objexample .encapsulation ;
2+
3+ public class Restaurant {
4+ private String name ;
5+ private String order ;
6+ private float cost ;
7+ private long phone_number ;
8+ public String getName () {
9+ return name ;
10+ }
11+ public void setName (String name ) {
12+ this .name = name ;
13+ }
14+ public String getOrder () {
15+ return order ;
16+ }
17+ public void setOrder (String order ) {
18+ this .order = order ;
19+ }
20+ public float getCost () {
21+ return cost ;
22+ }
23+ public void setCost (float cost ) {
24+ this .cost = cost ;
25+ }
26+ public long getPhone_number () {
27+ return phone_number ;
28+ }
29+ public void setPhone_number (long phone_number ) {
30+ this .phone_number = phone_number ;
31+ }
32+
33+ }
Original file line number Diff line number Diff line change 1+ package com .objexample .encapsulation ;
2+
3+ public class Restaurant_details {
4+ public static void main (String [] args ) {
5+ Restaurant Food_love = new Restaurant ();
6+ Food_love .setName ("Foody" );
7+ Food_love .setCost (654 );
8+ Food_love .setOrder ("chinese" );
9+ Food_love .setPhone_number (123456789 );
10+ System .out .println (Food_love .getName ());
11+ System .out .println (Food_love .getCost ());
12+ System .out .println (Food_love .getOrder ());
13+ System .out .println (Food_love .getPhone_number ());
14+ }
15+
16+ }
You can’t perform that action at this time.
0 commit comments