Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ContactManager
Submodule ContactManager added at d20288
Binary file not shown.
Binary file modified JavaTestMahesh/bin/com/mahesh/exceptionHandelling/Example.class
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public class ClassCast {
public static void main(String[] args) {
try {
Object obj = new Integer(100);
Object obj = new Integer(10);
System.out.println((float) obj);
} catch (ClassCastException e) {
System.out.println("Check the casting");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public Example(String message) {
static {
/* Store the first 10 characters of the input message. */
subMessage = message.substring(0, 10);

}

public String getSubMessage() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@

public class ExceptionChecked {
public static void main(String args[]) {
String content = "Hello Mahesh";
String content = "Hello Vishwa";
FileInputStream fis = null;
try {
fis = new FileInputStream("C:/Softgen/mahesh.txt");
fis = new FileInputStream("D:/java programs/vishwa.txt");
} catch (FileNotFoundException fnfe) {
System.out.println("The specified file is not "
+ "present at the given path");
}
int k;
try {
File file = new File("C:/Softgen/mahesh.txt");
File file = new File("D:/java programs/vishwa.txt");
// if file doesnt exists, then create it
if (!file.exists()) {
file.createNewFile();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.mahesh.exceptionHandelling;


public class VariableDemo {
static int count = 0;

public void increment(){
count++;
}

static{
System.out.println("Static value");
}

public static void main(String[] args) {
VariableDemo obj1 = new VariableDemo();
VariableDemo obj2 = new VariableDemo();
System.out.println("Obj1: count is = " + obj1.count);
System.out.println("Obj2: count is = " + obj2.count );
obj1.increment();
System.out.println("Obj2: count is = " + obj2.count );
obj2.increment();

System.out.println("Obj1: count is = " + obj1.count);

}

}
Binary file modified VishwaCoreJava/bin/com/vishwa/corejava/MethodOverloading.class
Binary file not shown.
Binary file modified VishwaCoreJava/bin/com/vishwa/corejava/MethodOverriding.class
Binary file not shown.
Binary file modified VishwaCoreJava/bin/com/vishwa/corejava/Methods.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.vishwa.corejava;

public class MethodOverloading {

public static void main(String[] args) {
}
}
2 changes: 2 additions & 0 deletions VishwaCoreJava/src/com/vishwa/corejava/MethodOverriding.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.vishwa.corejava;

public class MethodOverriding {
public static void main(String[] args) {

}
}
15 changes: 15 additions & 0 deletions VishwaCoreJava/src/com/vishwa/corejava/Methods.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ public static void main(String[] args) {
Methods.sub(99, 55);
Methods obj = new Methods();
obj.add(12, 56);
double div = obj.div(12.96, 5.656);
float mul = multi(23f, 54.44f);
System.out.println(mul);
}

private double div(double d, double e) {
return d / e;
}

public static float multi(float f, float g) {
return f * g;
}

public void add(int x, int y) {
Expand All @@ -14,4 +25,8 @@ public void add(int x, int y) {
public static void sub(int x, int y) {
System.out.println(x - y);
}

private void multiply() {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.vishwa.corejava.loops;

public class ForLoopExample {
public static void main(String[] args) {
System.out.println();
}
}
27 changes: 27 additions & 0 deletions VishwaCoreJava/src/com/vishwa/corejava/loops/MethodTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.vishwa.corejava.loops;

public class MethodTest {

public static void main(String[] args) {
int i = 5;
int j = 2;
// int k = max(i, j);
int x = 10;

if ((x == 10) || i <= 10)
System.out.println("One");

// System.out.println("The maximum between " +i + " and "+ j + " is "+
// k);
}
// public static int max(int num1, int num2){
// int result;
// if(num1 > num2)
// result = num1;
// else
// result = num2;
//
// return result;
// }

}
1 change: 1 addition & 0 deletions vishwaandroid/ContactManager
Submodule ContactManager added at d20288