├── Basic Programs ├── Arithmatic.java ├── HelloWorld.java ├── InputMethods.java ├── Primitive.java └── Strings.java ├── LICENSE ├── README.md ├── add.java.txt └── hello.java /Basic Programs/Arithmatic.java: -------------------------------------------------------------------------------- 1 | public class Arithmatic { 2 | public static void main(String[] args) { 3 | int a = 50, b = 5; 4 | System.out.println("Addition is " + (a + b)); 5 | System.out.println("Multiplication is " + (a * b)); 6 | System.out.println("Division is " + (a / b)); 7 | System.out.println("Substraction is " + (a - b)); 8 | System.out.println("Modulus is " + (a % b)); 9 | } 10 | } -------------------------------------------------------------------------------- /Basic Programs/HelloWorld.java: -------------------------------------------------------------------------------- 1 | public class HelloWorld { 2 | public static void main(String[] args) { 3 | System.out.println("Hello, World!"); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Basic Programs/InputMethods.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class InputMethods { 4 | public static void main(String[] args) { 5 | Scanner scanner = new Scanner(System.in); 6 | 7 | // Basic Input methods 8 | System.out.println("Enter your name: "); 9 | String name = scanner.next(); 10 | scanner.nextLine(); 11 | System.out.println("Enter your college name: "); 12 | String college = scanner.nextLine(); // Read the whole line 13 | System.out.println("Enter your Roll number: "); 14 | int rollNumber = scanner.nextInt(); 15 | System.out.println("Enter your 1st Year marks Percentage: "); 16 | float marks = scanner.nextFloat(); // variable declaration 17 | scanner.close(); 18 | 19 | System.out.println("--------- Your Details ---------\n"); 20 | System.out.println("Name :" + name); 21 | System.out.println("\nCollege : " + college); 22 | System.out.println("\nRoll No : " + rollNumber); 23 | System.out.println("\nPercentage : " + marks); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Basic Programs/Primitive.java: -------------------------------------------------------------------------------- 1 | public class Primitive { 2 | public static void main(String[] args) { 3 | 4 | // Primitive data types 5 | 6 | int Mynumber = 97; // ranging from -2,147,483,648 to 2,147,483,647. 7 | short Myshort = 830; // ranging from -32,768 to 32,767. 8 | long Mylong = 97723323; // ranging from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. 9 | 10 | double Mydouble = 7.121121; 11 | float Myfloat = 3.45f; 12 | 13 | char Mychar = 'Y'; 14 | boolean Myboolean = true; 15 | 16 | byte Mybyte = 127; 17 | 18 | System.out.println(Mynumber); 19 | System.out.println(Myshort); 20 | System.out.println(Mylong); 21 | System.out.println(Mydouble); 22 | System.out.println(Myfloat); 23 | System.out.println(Mychar); 24 | System.out.println(Myboolean); 25 | System.out.println(Mybyte); 26 | } 27 | } -------------------------------------------------------------------------------- /Basic Programs/Strings.java: -------------------------------------------------------------------------------- 1 | public class Strings { 2 | public static void main(String[] args) { 3 | 4 | int Myinteger = 97; 5 | 6 | String text = "Hello"; 7 | String blank = " "; 8 | String name = "Yethishwar"; 9 | String greeting = text + blank + name; 10 | 11 | System.out.println(greeting); 12 | System.out.println("Hello" + " " + name); // Concatenation 13 | 14 | System.out.println("Thi is Integer value:" + " " + Myinteger); 15 | 16 | } 17 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Madavaram Yethishwar 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JavaLabCraft -------------------------------------------------------------------------------- /add.java.txt: -------------------------------------------------------------------------------- 1 | class add{ 2 | public static void main(String[] args){ 3 | Scanner sc=new Scanner(System.in); 4 | int a=sc.nextInt(); 5 | int b=sc.nextInt(); 6 | System.out.println("addition of two numbers" +a+ " + "+b+ " is"+(a+b)); 7 | } 8 | } -------------------------------------------------------------------------------- /hello.java: -------------------------------------------------------------------------------- 1 | class hello 2 | { 3 | public static void main(String[] args) 4 | { 5 | System.out.println("hello world!"); 6 | } 7 | } --------------------------------------------------------------------------------