What is Java?Java is a programming language and computing platform first released by Sun Microsystems in 1995.There are lots of applications and websites that will not work unless you have Java installed, and more are created every day. Java is fast, secure, and reliable. From laptops to datacenters,...
Search This Blog
Sunday, May 30, 2021
Permutation And Combination in Java
Permutation And CombinationThe Java code below takes input from the user to return permutation and combination. import java.util.Scanner;public class Math_programme { static int factorial(int a){ if (a==0){ return 1; } else if (a==1){ ...
Friday, May 28, 2021
Head First Java 2nd Edition PDF

Book descriptionLearning a complex new language is no easy task especially when it s an object-oriented computer programming language like Java. You might think the problem is your brain. It seems to have a mind of its own, a mind that doesn't always want to take in the dry, technical stuff you're...
Calculator source code (java)
Calculatorimport java.util.Scanner;public class Calculator { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a1 = 1; while (a1 == 1){ System.out.print("Enter 1st no: "); float input1 = sc.nextFloat(); ...
Find Leap Year source code (java)
Find Leap Yearimport java.util.Scanner;public class LeapYear { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = 1; while (n==1){ System.out.println("Enter the year: "); int y = sc.nextInt(); ...
The Bear Song source code (java)
The Bear Songpublic class beer_song { public static void main(String[] args) { int beerNum = 10; String word =new String("bottles") ; while (beerNum > 0) { if (beerNum == 1) { word = "bottle"; // singular,...
Making a Fibonacci series source code(java) (two approaches)
Making a Fibonacci series using 'for loop'***********************************************import java.util.Scanner;public class fibonacci_series { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int times=0; while (times<10){ int a=0; ...
Career Guidance AI source code(java)
Career Guidance AI import java.sql.Time;import java.util.Random;import java.util.Scanner;import java.util.concurrent.TimeUnit;public class career { static void loading(){ System.out.print("Loading"); for (int a =1;a<3;a++){ System.out.print("..."); ...
Rock Paper Scissor game source code (java)
Rock Paper Scissor game import java.util.Scanner;import java.util.Random;public class rock { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Random ra = new Random(); int j = 1; while (j == 1){ System.out.println("Rock->0...
Encrypt and Decrypt secret messages source code (java)
Encrypt and Decrypt import java.util.Locale;import java.util.Scanner;import java.util.concurrent.TimeUnit;public class ED { static void sleep(int a) throws InterruptedException { TimeUnit.SECONDS.sleep(a); } static String encrypt(String a) throws InterruptedException { System.out.println("Encrypting...."); ...
'Guess the number game' source code(java)
import java.util.Random;import java.util.Scanner;class game{ Random ra=new Random(); Scanner sc=new Scanner(System.in); int theNum= ra.nextInt(100); public void cond(int l){ for (int i=1;i<=l;i++){ System.out.println(" "+i); System.out.print("Enter your number: "); int a=sc.nextInt(); if (theNum>a){ System.out.println("Greater than "+a); } else if (theNum<a){ System.out.println("Less than...
Thursday, May 27, 2021
How to extract the last n characters from a string using Java?
Example:public class ExtractingCharactersFromStrings {
public static void main(String args[]) {
String str = "Hi welcome to tutorialspoint";
int n = 5;
int initial = str.length()-5;
for(int i=initial; i<str.length(); i++) {
System.out.println(str.charAt(i));
...
Subscribe to:
Posts (Atom)