web.xml
is the deployment descriptor for a Java web application.
We can specify the namespace declaration and schema location in web.xml
file for different Java servlet version:
- Java Servlet 3.1
- Java Servlet 3.0
- Java Servlet 2.5
- Java Servlet 2.4
public class BreakStatementExample { | |
public static void main(String[] args) { | |
// Using break statement in for loop | |
System.out.println("Using break statement in for loop"); | |
for (int count = 1; count <= 10; count++) { | |
if (count == 6) { | |
break; | |
} |
public class EnumSwitchStatementExample { | |
public static void main(String[] args) { | |
// Using enum Type Argument in The switch Statement | |
Day day = Day.TUESDAY; | |
switch (day) { | |
case MONDAY: | |
case TUESDAY: |
public class IfElseStatementExample { | |
public static void main(String[] args) { | |
// Initialization | |
int score = 0; | |
String today = ""; | |
// Example 1: if Statement | |
score = 150; |
web.xml
is the deployment descriptor for a Java web application.
We can specify the namespace declaration and schema location in web.xml
file for different Java servlet version:
package com.chankok.io; | |
import java.io.FileReader; | |
import java.io.IOException; | |
public class Java6ReadEntireFileExample { | |
public static void main(String[] args) { | |
FileReader fr = null; |
package com.chankok.operators; | |
public class CheckEvenOddNumberExample { | |
public static void main(String[] args) { | |
// Initial the integer array | |
int[] intArrays = {-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5}; | |
/* |
package com.chankok.io; | |
import java.io.FileReader; | |
import java.io.IOException; | |
public class Java6ResourceManagementExample { | |
public static void main(String[] args) { | |
FileReader fr = null; |
package com.chankok.oop; | |
public class DataEncapsulationExample { | |
public static void main(String[] args) { | |
try { | |
Student student1 = new Student(); | |
student1.setName("Chankok"); |
public class StringBuilderExample { | |
public static void main(String[] args) { | |
StringBuilder sb = new StringBuilder(); | |
// Append strings | |
sb.append("Welcome").append(' ').append("to").append(' ').append("Chankok.com"); | |
System.out.println("Append strings : " + sb.toString()); |
// Syntax of catching multiple exceptions | |
Try { | |
// Execute statements that may throw exceptions | |
} catch (ExceptionType1 | ExceptionType2 | ... VariableName) { | |
// Handle exceptions |