Program to print following series: Code: import java.util.*; import java.io.*; class Test{ public static void main(St...
Read More
Showing posts with label Java Practical. Show all posts
Showing posts with label Java Practical. Show all posts
System.out.printf() in Java
Code: import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner sc=new Scanner(...
Read More
How to get day from specific date in Java
Code: import java.util.*; import java.text.*; import java.time.LocalDate; class Test{ public static void main(String []argh) thr...
Read More
Check IP Address Pattern using regex match in Java
Code: import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Test { public sta...
Read More
4 Set up a Java Programming development environment by using (a) command Prompt, set the PATH environment variable, write the steps for all of these and run a simple java program to display string hello world to test setup is correct.
Setting up Java Environment Using Command Prompt: Setting up Java Environment Using Environmental Variable: Steps to Run Java P...
Read More
3 Write the java Program to demonstrate the use of If else-if ladder. And display student grading as fail, D grade, C grade, B grade, A grade and A+.
Code: public class IfElseIfExample { public static void main(String[] args) { int marks=65; if(marks<50) { System...
Read More
2 Write the program to demonstrate the use of method that take variable length arguments using Var-args function in Java.
Code: class VarargExample { public int sumNumber(int ... args) { System.out.println("argument length: " + args.length)...
Read More
1 Write the program to demonstrate the use of for-each version of for loop in Java.
Code: public class Test { public static void main(String args[]) { int [] numbers = {10, 20, 30, 40, 50}; for(int x : num...
Read More
Can we able to compile and execute Java Program without Class?
Can we compile and execute without class? yes jdk 1.5 : enum; jdk 1.8 : interface; Code: Using Enum enum Test { ; p...
Read More
Subscribe to:
Posts (Atom)