Skip to content

Commit 2b8c3d1

Browse files
author
codehouseindia
authored
Merge branch 'master' into master
2 parents d252e16 + 569f707 commit 2b8c3d1

475 files changed

Lines changed: 27950 additions & 18 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1add.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
class Main {
2+
public static void main(String[] args) {
3+
4+
// create boolean variables
5+
boolean booleanValue1 = true;
6+
boolean booleanValue2 = false;
7+
8+
// convert boolean to string
9+
// using valueOf()
10+
String stringValue1 = String.valueOf(booleanValue1);
11+
String stringValue2 = String.valueOf(booleanValue2);
12+
13+
System.out.println(stringValue1); // true
14+
System.out.println(stringValue2); // true
15+
}
16+
}

Abstract_Class_Example.java

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
//Subscribed by Mritunjay Kumar
2+
//https://www.facebook.com/Mritunjay70/posts/1445812775628125
3+
abstract class Person {
4+
String name;
5+
int age;
6+
7+
Person() {
8+
9+
}
10+
Person(String n, int r) {
11+
name = n;
12+
age = r;
13+
}
14+
15+
void setData(String name1, int age1)
16+
{
17+
name = name1;
18+
age = age1;
19+
}
20+
21+
void printDetails()
22+
{
23+
System.out.print("Name: "+name+" Age: "+age);
24+
}
25+
26+
abstract void exceptional();
27+
28+
final void isAdult() {
29+
if (age > 18) System.out.println("\t Yes");
30+
}
31+
} // class Person ends
32+
33+
class Student extends Person
34+
{
35+
double cpi;
36+
37+
Student() {
38+
39+
}
40+
Student(String n, int r, double c) {
41+
42+
super(n, r);
43+
cpi = c;
44+
}
45+
46+
void setData(String name1, int age1, double cpi1)
47+
{
48+
super.setData(name1, age1);
49+
cpi = cpi1;
50+
}
51+
52+
void printDetails()
53+
{
54+
System.out.println();
55+
super.printDetails();
56+
System.out.print(" CPI: "+cpi);
57+
}
58+
59+
void f() {
60+
61+
}
62+
63+
void exceptional()
64+
{
65+
if (cpi > 9.5) System.out.print(" Exceptional ");
66+
}
67+
68+
void isAdult(Person p) {
69+
70+
}
71+
} // class Student ends here
72+
73+
abstract class test extends Student {
74+
abstract void f();
75+
void f2(){
76+
77+
}
78+
}
79+
80+
class Faculty extends Person
81+
{
82+
float noOfPub;
83+
84+
Faculty() {
85+
86+
}
87+
Faculty(String n, int r, float nop) {
88+
super(n, r);
89+
noOfPub = nop;
90+
}
91+
92+
void setData(String name1, int age1, int nop)
93+
{
94+
super.setData(name1, age1);
95+
noOfPub = nop;
96+
}
97+
98+
void printDetails()
99+
{
100+
System.out.println();
101+
super.printDetails();
102+
System.out.print(" No of Pub: "+noOfPub);
103+
}
104+
105+
void exceptional()
106+
{
107+
if (noOfPub > 100) System.out.print(" Exceptional ");
108+
}
109+
}
110+
111+
public class AbstractDemo {
112+
113+
public static void main(String[] args)
114+
{
115+
Student s1 = new Student(), s2 = new Student();
116+
Faculty f1 = new Faculty(), f2 = new Faculty();
117+
118+
s1.setData("A", 10, 9.7); s2.setData("B", 10, 7.0);
119+
f1.setData("C", 70, 300); f2.setData("D", 75, 50);
120+
121+
Person [] p= new Person[4];
122+
123+
p[0] = s1;
124+
p[1] = s2;
125+
p[2] = f1;
126+
p[3] = f2;
127+
128+
for (int index=0; index<p.length; index++)
129+
{
130+
p[index].printDetails();
131+
p[index].exceptional();
132+
p[index].isAdult();
133+
}
134+
135+
}
136+
137+
}

Add Elements Using add().java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import java.util.LinkedList;
2+
3+
class Main {
4+
public static void main(String[] args){
5+
6+
// create a linkedlist
7+
LinkedList<String> languages = new LinkedList<>();
8+
9+
// Add elements to LinkedList
10+
languages.add("Java");
11+
languages.add("Python");
12+
languages.add("JavaScript");
13+
System.out.println("LinkedList: " + languages);
14+
}
15+
}

Add Number

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
public class AddTwoNumbers {
2+
3+
public static void main(String[] args) {
4+
5+
int num1 = 5, num2 = 15, sum;
6+
sum = num1 + num2;
7+
8+
System.out.println("Sum of these numbers: "+sum);
9+
}
10+
}

Addition.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#https://www.facebook.com/mayankgbrc/post/2726954114288546
2+
#subscribe by code house
3+
import java.util.*;
4+
5+
public class addition
6+
{
7+
public static void main(String[] args)
8+
{
9+
//write your code here
10+
11+
scanner digit=new scanner(system.in);
12+
int n,m,c;
13+
system.out.println("enter the two number");
14+
n=digit.nextint();
15+
m=digit.nextint();
16+
c=m+n;
17+
system.out.println("the sum of the number is "+c);
18+
}
19+
}

AdultUsers.class

1.24 KB
Binary file not shown.

Amstrom.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# https//www.facebook.com/yashwantbisht/73738473829
2+
# subscribed by codehouse
3+
In [13]: open?
4+
Type:           builtin_function_or_method
5+
Base Class:     <type 'builtin_function_or_method'>
6+
String Form:    <built­in function open>
7+
Namespace:      Python builtin
8+
Docstring:
9+
    open(name[, mode[, buffering]]) ­> file object
10+
    Open a file using the file() typereturns a file 
11+
object.
12+
Constructor Docstring:
13+
    x.__init__(...) initializes xsee 
14+
x.__class__.__doc__ for signature

Anagram.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#https://www.facebook.com/permalink.php?story_fbid=2038372642966043&id=100003799820060
2+
#Subscribed by Kattebaaz
3+
import java.util.Arrays;
4+
5+
public class AnagramString {
6+
static void isAnagram(String str1, String str2) {
7+
String s1 = str1.replaceAll("\\s", "");
8+
String s2 = str2.replaceAll("\\s", "");
9+
boolean status = true;
10+
if (s1.length() != s2.length()) {
11+
status = false;
12+
} else {
13+
char[] ArrayS1 = s1.toLowerCase().toCharArray();
14+
char[] ArrayS2 = s2.toLowerCase().toCharArray();
15+
Arrays.sort(ArrayS1);
16+
Arrays.sort(ArrayS2);
17+
status = Arrays.equals(ArrayS1, ArrayS2);
18+
}
19+
if (status) {
20+
System.out.println(s1 + " and " + s2 + " are anagrams");
21+
} else {
22+
System.out.println(s1 + " and " + s2 + " are not anagrams");
23+
}
24+
}
25+
26+
public static void main(String[] args) {
27+
isAnagram("Keep", "Peek");
28+
isAnagram("Mother In Law", "Hitler Woman");
29+
}
30+
}

Animal.class

470 Bytes
Binary file not shown.

Apple.class

643 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)