------------------------------
Introducing myself :
------------------------------
I'm also a student like you studying BCA 3rd year, I started this channel to share the knowledge of C programming .
I try to gather as much programs as I can and share them with you, hoping you will support the channel by sharing this channel with your friends who are aiming to practice programs.
Channel link is here👇
https://t.me/Java_language_programming
If I make any mistakes in any program message me the mistake I had made so I'll try to correct them.
contact here 👇
@imabhi3030
Introducing myself :
------------------------------
I'm also a student like you studying BCA 3rd year, I started this channel to share the knowledge of C programming .
I try to gather as much programs as I can and share them with you, hoping you will support the channel by sharing this channel with your friends who are aiming to practice programs.
Channel link is here👇
https://t.me/Java_language_programming
If I make any mistakes in any program message me the mistake I had made so I'll try to correct them.
contact here 👇
@imabhi3030
❤3👍3
Program to print hello world in java
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
Program to add two numbers
-------------------------------------------------
Program:
import java.util.Scanner;
public class AddTwoNumbers {
public static void main(String[] args) {
// Create a Scanner object to read input from the user
Scanner scanner = new Scanner(System.in);
System.out.print("Enter the first number: ");
// Read the first number from the user
double num
#basicprogramsProgram to add two numbers by accepting input from the user:
----------------------------------------------------
Program:
import java.util.Scanner;
public class AddTwoNumbers {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
// Prompt the user to enter the first number
System.out.print("Enter the first number: ");
int num1 = input.nextInt();
// Prompt the user to enter the second number
System.out.print("Enter the second number: ");
int num2 = input.nextInt();
// Add the two numbers
int sum = num1 + num2;
// Display the result
System.out.println("The sum of " + num1 + " and " + num2 + " is " + sum);
}
}
----------------------------------------------------
#basicprograms
----------------------------------------------------
Program:
import java.util.Scanner;
public class AddTwoNumbers {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
// Prompt the user to enter the first number
System.out.print("Enter the first number: ");
int num1 = input.nextInt();
// Prompt the user to enter the second number
System.out.print("Enter the second number: ");
int num2 = input.nextInt();
// Add the two numbers
int sum = num1 + num2;
// Display the result
System.out.println("The sum of " + num1 + " and " + num2 + " is " + sum);
}
}
----------------------------------------------------
#basicprograms
👍1
here's a sample Java program that computes the factorial of a given integer using recursion:
public class FactorialExample {
public static void main(String[] args) {
int num = 5; // the number whose factorial is to be found
int factorial = calculateFactorial(num);
System.out.println("The factorial of " + num + " is " + factorial);
}
public static int calculateFactorial(int num) {
if (num == 0) {
return 1;
} else {
return num * calculateFactorial(num - 1);
}
}
}
public class FactorialExample {
public static void main(String[] args) {
int num = 5; // the number whose factorial is to be found
int factorial = calculateFactorial(num);
System.out.println("The factorial of " + num + " is " + factorial);
}
public static int calculateFactorial(int num) {
if (num == 0) {
return 1;
} else {
return num * calculateFactorial(num - 1);
}
}
}
👍3
Program with use of switch case to find a months
public class Example{
public static void main(String args[]){
int month= 7;
switch(month){
case 1 :
System.out.println("january");
break;
case 2:
System.out.println("february");
break;
case 3:
System.out.println("march");
break;
case 4:
System.out.println("april");
break;
case 5:
System.out.println("may");
break;
case 6:
System.out.println("june");
break;
case 7:
System.out.println("july");
break;
case 8:
System.out.println("august");
break;
case 9:
System.out.println("september");
break;
case 10:
System.out.println("October");
break;
case 11:
System.out.println("november");
break;
case 12:
System.out.println("december");
break;
default:
System.out.println("not valid");
}
}
}
Output: july
public class Example{
public static void main(String args[]){
int month= 7;
switch(month){
case 1 :
System.out.println("january");
break;
case 2:
System.out.println("february");
break;
case 3:
System.out.println("march");
break;
case 4:
System.out.println("april");
break;
case 5:
System.out.println("may");
break;
case 6:
System.out.println("june");
break;
case 7:
System.out.println("july");
break;
case 8:
System.out.println("august");
break;
case 9:
System.out.println("september");
break;
case 10:
System.out.println("October");
break;
case 11:
System.out.println("november");
break;
case 12:
System.out.println("december");
break;
default:
System.out.println("not valid");
}
}
}
Output: july
👍3🔥1
Subscribe our channel for termux hacking,python animation,coding,html ,telegram bot tips & trick related - 👉 https://youtube.com/@CODEBOMBS Subscribe our channel for termux hacking, designing, tips & trick, bot making related - 👉 https://youtube.com/@TECHINDNN
//#4 Declaring & iniitializing Array
public class MyClass {
public static void main(String args[]) {
int arr[]; //declaring array
arr = new int[20]; // allocating memory
arr[0]= 55; //iniitializing first element
arr[1]= 33; //initi.... 2nd Element
System.out.println(arr[0]);
}
}❤2
//#4 Declaring & iniitializing Array
public class MyClass {
public static void main(String args[]) {
int arr[]; //declaring array
arr = new int[20]; // allocating memory
arr[0]= 55; //iniitializing first element
arr[1]= 33; //initi.... 2nd Element
System.out.println(arr[0]);
}
}❤4👍1
🔰 join ᴏᴜʀ ᴀʟʟ ᴄʜᴀɴɴᴇʟs for coding 🔰
ᴛᴇʀᴍᴜx ʜᴀᴄᴋɪɴɢ ᴄʟɪᴄᴋ ʜᴇʀᴇ
ᴛᴇʀᴍᴜx ᴄᴏᴍᴍᴀɴᴅ ᴄʟɪᴄᴋ ʜᴇʀᴇ
ᴛᴇʀᴍᴜx ᴛʀɪᴄᴋs ᴄʟɪᴄᴋ ʜᴇʀᴇ
ᴘʜᴘ ʟᴀɴɢᴜᴀɢᴇs ᴄʟɪᴄᴋ ʜᴇʀᴇ
ᴄ ᴘʀᴏɢʀᴀᴍᴍɪɴɢ ᴄʟɪᴄᴋ ʜᴇʀᴇ
ᴄ++ ʟᴀɴɢᴜᴀɢᴇ ᴄʟɪᴄᴋ ʜᴇʀᴇ
ᴄ# ʟᴀɴɢᴜᴀɢᴇ ᴄʟɪᴄᴋ ʜᴇʀᴇ
ᴊᴀᴠᴀ ʟᴀɴɢᴜᴀɢᴇ ᴄʟɪᴄᴋ ʜᴇʀᴇ
ᴄss ʟᴀɴɢᴜᴀɢᴇ ᴄʟɪᴄᴋ ʜᴇʀᴇ
ᴘʏᴛʜᴏɴ ʟᴀɴɢᴜᴀɢᴇ ᴄʟɪᴄᴋ ʜᴇʀᴇ
ᴛʏᴘᴇsᴄʀɪᴘᴛ ᴄʟɪᴄᴋ ʜᴇʀᴇ
ᴊᴀᴠᴀsᴄʀɪᴘᴛ ᴄʟɪᴄᴋ ʜᴇʀᴇ
ʜᴛᴍʟ ʟᴀɴɢᴜᴀɢᴇ ᴄʟɪᴄᴋ ʜᴇʀᴇ
ᴛᴇʀᴍᴜx ʜᴀᴄᴋɪɴɢ ᴄʟɪᴄᴋ ʜᴇʀᴇ
ᴛᴇʀᴍᴜx ᴄᴏᴍᴍᴀɴᴅ ᴄʟɪᴄᴋ ʜᴇʀᴇ
ᴛᴇʀᴍᴜx ᴛʀɪᴄᴋs ᴄʟɪᴄᴋ ʜᴇʀᴇ
ᴘʜᴘ ʟᴀɴɢᴜᴀɢᴇs ᴄʟɪᴄᴋ ʜᴇʀᴇ
ᴄ ᴘʀᴏɢʀᴀᴍᴍɪɴɢ ᴄʟɪᴄᴋ ʜᴇʀᴇ
ᴄ++ ʟᴀɴɢᴜᴀɢᴇ ᴄʟɪᴄᴋ ʜᴇʀᴇ
ᴄ# ʟᴀɴɢᴜᴀɢᴇ ᴄʟɪᴄᴋ ʜᴇʀᴇ
ᴊᴀᴠᴀ ʟᴀɴɢᴜᴀɢᴇ ᴄʟɪᴄᴋ ʜᴇʀᴇ
ᴄss ʟᴀɴɢᴜᴀɢᴇ ᴄʟɪᴄᴋ ʜᴇʀᴇ
ᴘʏᴛʜᴏɴ ʟᴀɴɢᴜᴀɢᴇ ᴄʟɪᴄᴋ ʜᴇʀᴇ
ᴛʏᴘᴇsᴄʀɪᴘᴛ ᴄʟɪᴄᴋ ʜᴇʀᴇ
ᴊᴀᴠᴀsᴄʀɪᴘᴛ ᴄʟɪᴄᴋ ʜᴇʀᴇ
ʜᴛᴍʟ ʟᴀɴɢᴜᴀɢᴇ ᴄʟɪᴄᴋ ʜᴇʀᴇ