Skip to main content

LEARNING CONTENT FOR JAVA IN TAMIL

LEARN JAVA IN TAMIL:
Java is easy and fun to learn, so lets learn java. 
Are you ready ???? !!!!! 


All the codes shown in the video is available here: 
//Basic java program 
package com.tamilhacks; 
import java.util.Scanner; 
public class Main 
     public static void main(String[] args) 
    
         // write your code here
         System.out.println("Tamil hacks") ; 
     
 //primitive data types 
byte number = 20 ;  
short number2 = 150; 
int number3 = 1999; 
long number4 = 123456789789L; 
float number5 = 11.5F;
double number6 = 1111.99999999; 
char alphabet = 'b' ; 
boolean bool = false ; 
System.out.println(bool); 
System.out.println(number); 

// reference data types 
 int number = 10; 
 //5 = 0 ,1, 2, 3, 4 
 int[] numbers = {10,11,12,13,15}; 
 // numbers[0] = 10; 
 // numbers[1] = 11; 
char name[] = {'a' ,'b' ,'s' ,'a'}; 
int len = name.length; 
char name1[] = name.clone();  
System.out.println(Arrays.toString(name1)); 
System.out.println((name[0])); 
System.out.println(len);

//STRINGS 

String channelName = "tamil Hacks" + " youtube channel"; System.out.println(channelName.endsWith("channels")); 
System.out.println(channelName); 
int numberOne = 1000 ; 
int ageOfPerson = 25 ; 
int numbers[] = { 1, 2, 3,}; 
int numbersOf2Dim[][] = { {1,2 } ,{ 1,3} }; 
byte number = 5; 
number = 10;
System.out.println(number); 

//constant 
 final int ageOfPerson1 = 18; 
 //ageOfPerson1 = 21; 
//operations 
 byte number1 = 20; 
 int number2 = 10; 
 int number3 = number2 + number1; 
 number2 *= 10; 
 int number4 = (5 + 5 )- 10 *5 *6 /9 /8 % 20; 
 int number5 = 2 / 2; 

//BODMAS 
//logical opertorss && , || , !! 

 int ageOfPerson = 21; 
 boolean indianCitizen = false; 
 // condition true false
 String name = ageOfPerson >= 18 ? "eligible" : "not eligible";
 int number10 = 10; 
 // -- number10 ; 
 int number11 = ++ number10;
System.out.println(number10);
System.out.println( number11 ); 

//MATH 
 int number = 100; 
 float number1 = 101.13f; 
 System.out.println(Math.log(number)); 
 String name ; int number1; 
 int number2; 

//Scanner 
Scanner input = new Scanner(System.in); 
 System.out.println("enter a name :"); 
 name = input.nextLine(); 
 number1 = input.nextInt(); 
 number2 = input.nextInt(); 
 System.out.println("hi ," + name + " " + name.toUpperCase() + " " + name.length());   System.out.println(number1 + number2); 
//if conditions 
 int pen = 10; 
 int specialPen = 20; 
 int cost ; 6
 Scanner input = new Scanner(System.in);
 cost = input.nextInt(); 
 if (cost > specialPen) //cost > 20 
 System.out.println("you can buy the special pen");  
 else if (cost > pen) 
{ //cost >10
     System.out.println("you can buy the pen"); 
     System.out.println("you have " + cost); 
} 
 else 
 System.out.println("you have less money to buy the pen"); 

//switch 
 int number = 10; 
 String name ; 
 Scanner input = new Scanner(System.in); 
 name = input.nextLine(); 
 switch (name)
     case "karthik" :
         System.out.println("hi, "+name); 
         break; 
     case "raj" : 
         System.out.println("hi, "+name); 
         break; 
     case "arun" : 
         System.out.println("hi, "+name); 
         break; 
     case "bharath" : 
         System.out.println("hi, "+name); 
         break; 
     default:
         System.out.println("your name is not in list"); 
} 
 //loops 
 //for loop , while , do while , for-each loop 
// 0 < 5 
for ( int initial = 1 ; initial > 0 ; initial -- )
     System.out.println("hi dude");
}
 //while loop 
int number = 3;
while(number > 10)
    //3>0 //2>0 //1>0 //0>0 
     System.out.println("while loop"); 
     number -- ; 
}
 //do while loop 
 int number1 = 3;
 do
     System.out.println("do while loop"); 
     number1 -- ; 
}
while (number1 > 10);
 //0 , 0<5 , 0+1 =1 , 1<5 , 2<5 , 3<5 , 4<5 , 5<5 
//for each - arrays 
 String vegetables[] = {"onion" , "carrot" ,"beans"}; 
 for(int i = vegetables.length-1 ; i > 0 ; i--)
    System.out.println(vegetables[i]); 
for(String vegetable : vegetables)
{
     System.out.println(vegetable); 
Some java example programs : 

1: Sum of two numbers 
public class AddTwoNumbers 
{ 
    public static void main(String[] args) 
    
        int num1 = 5, num2 = 15, sum; 
        sum = num1 + num2; 
        System.out.println("Sum of these numbers: "+sum); 
    
Output: 
Sum of these numbers:
20 

2: Sum of two numbers using Scanner
import java.util.Scanner; 
public class AddTwoNumbers2 
    public static void main(String[] args) 
    
        int num1, num2, sum; 
        Scanner sc = new Scanner(System.in); 
        System.out.println("Enter First Number: "); 
        num1 = sc.nextInt(); 
        System.out.println("Enter Second Number: "); 
        num2 = sc.nextInt(); 
        sc.close(); 
        sum = num1 + num2; 
        System.out.println("Sum of these numbers: "+sum); 
     } 
} 
Output: 
Enter First Number: 
121 
Enter Second Number: 
19 
Sum of these numbers: 
140 

3:Java Program to check Even or Odd number 
import java.util.Scanner; 
class CheckEvenOdd 
    public static void main(String args[]) 
    
        int num; System.out.println("Enter an Integer number:"); 
        //The input provided by user is stored in num 
        Scanner input = new Scanner(System.in); 
        num = input.nextInt();
        /* If number is divisible by 2 then it's an even number * else odd number*/ 
        if ( num % 2 == 0 ) 
        System.out.println("Entered number is even"); 
        else 
        System.out.println("Entered number is odd"); 
    
}
 Output 1:
Enter an Integer number: 
78 
Entered number is even 
Output 2: 
Enter an Integer number: 
77 
Entered number is odd 

4: Program to check whether the input year is leap or not 
import java.util.Scanner; 
public class Demo 
     public static void main(String[] args) 
    
         int year; 
         Scanner scan = new Scanner(System.in); 
         System.out.println("Enter any Year:"); 
         year = scan.nextInt(); 
         scan.close(); 
         boolean isLeap = false; 
         if(year % 4 == 0) 
         { 
              if( year % 100 == 0) 
             { 
                 if ( year % 400 == 0) 
                 isLeap = true; 
                else 
                isLeap = false; 
             } 
             else 
                 isLeap = true; 
         } 
         else 
        {
             isLeap = false; 
         } 
         if(isLeap==true) 
         System.out.println(year + " is a Leap Year."); 
         else 
         System.out.println(year + " is not a Leap Year."); 
     } 
Output: 
Enter any Year: 
2001 
2001 is not a Leap Year. 

5: Program to find the smallest of three numbers using ternary operator 
import java.util.Scanner; 
public class JavaExample 
     public static void main(String[] args) 
     { 
         int num1, num2, num3, result, temp; 
         /* Scanner is used for getting user input. 
          * The nextInt() method of scanner reads the 
          * integer entered by user. 
         */ 
         Scanner scanner = new Scanner(System.in); 
         System.out.println("Enter First Number:"); 
         num1 = scanner.nextInt();
         System.out.println("Enter Second Number:"); 
         num2 = scanner.nextInt();
         System.out.println("Enter Third Number:");
         num3 = scanner.nextInt(); scanner.close();
        /* In first step we are comparing only num1 and 
         * num2 and storing the smallest number into the 
         * temp variable and then comparing the temp and 
         * num3 to get final result. 
         */
         temp = num1 < num2 ? num1:num2; 
         result = num3 < temp ? num3:temp; 
         System.out.println("Smallest Number is:"+result); 
     } 
Output: 
Enter First Number: 
67 
Enter Second Number: 
Enter Third Number: 
Smallest Number is:

6: Program to display even numbers from 1 to n where n is 100
 
class JavaExample 
{
     public static void main(String args[]) 
    { 
        int n = 100; 
        System.out.print("Even Numbers from 1 to "+n+" are: "); 
        for (int i = 1; i <= n; i++) 
        
        //if number%2 == 0 it means its an even number 
            if (i % 2 == 0) 
            {
                 System.out.print(i + " "); 
             
        
     
Output: 
Even Numbers from 1 to 100 are:
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100 

7 : Program will prompt user for the input number. Once user provide the input, the program will calculate the factorial for the provided input number. 

import java.util.Scanner; 
class FactorialDemo
     public static void main(String args[])
    
         //Scanner object for capturing the user input 
        Scanner scanner = new Scanner(System.in); 
        System.out.println("Enter the number:"); 
         //Stored the entered value in variable 
         int num = scanner.nextInt(); 
         //Called the user defined function fact
         int factorial = fact(num); 
        System.out.println("Factorial of entered number is: "+factorial); 
     } 
     static int fact(int n) 
     { 
         int output; if(n==1)
        
             return 1; 
        
        //Recursion: Function calling itself!! 
        output = fact(n-1)* n; 
        return output; 
     } 
}
 Output: 
Enter the number: 
5
Factorial of entered number is: 
120 
8: No user interaction 
 class SumOfArray
    public static void main(String args[])
    
         int[] array = {10, 20, 30, 40, 50, 10}; 
         int sum = 0; 
         //Advanced for loop 
         for( int num : array) 
        
             sum = sum+num; 
        
        System.out.println("Sum of array elements is:"+sum); 
    
Output: 
Sum of array elements is:
160 

9: Reverse a number using while Loop 
import java.util.Scanner; 
class ReverseNumberWhile 
     public static void main(String args[]) 
     { 
         int num=0; 
         int reversenum =0; 
         System.out.println("Input your number and press enter: ");  
        //This statement will capture the user input 
         Scanner in = new Scanner(System.in); 
        //Captured input would be stored in number num 
         num = in.nextInt(); 
         //While Loop: Logic to find out the reverse number 
        while( num != 0 ) 
        
             reversenum = reversenum * 10; 
             reversenum = reversenum + num%10; 
             num = num/10; 
        
      System.out.println("Reverse of input number is: "+reversenum); 
    
Output: 
Input your number and press enter: 
145689 
Reverse of input number is: 
986541
  
10: Program to generate random numbers 
import java.util.*; 
class GenerateRandomNumber 
    public static void main(String[] args) 
    
         int counter; 
         Random rnum = new Random(); 
         /* Below code would generate 5 random numbers * between 0 and 200. */ 
         System.out.println("Random Numbers:"); 
         System.out.println("***************"); 
         for (counter = 1; counter <= 5; counter++) 
        
             System.out.println(rnum.nextInt(200)); 
        
     } 
Output: 
Random Numbers: 
*************** 
135 173 5 17 15 

Java notes : 
  • Java is a simple language.
  • Java is easy to learn and its syntax is clear and concise. 
  • It is based on C++ (so it is easier for programmers who know C++).Java is an object-oriented programming language.
  • OOP makes the complete program simpler by dividing it into a number of objects. 
Why Learn Java? 
    Java is among the most popular programming languages out there, mainly because of how versatile and compatible it is. Java can be used for a large number of things, including software development, mobile applications, and large systems development. As of 2019, 88% market share of all smartphones run on Android, the mobile operating system written in Java. Knowing Java opens a great deal of doors for you as a developer. 
About Java 

Java is a simple language: 
    Java is easy to learn and its syntax is clear and concise. It is based on C++ (so it is easier for                     programmers who know C++). Java has removed many confusing and rarely-used features e.g.                explicit pointers, operator overloading etc. Java also takes care of memory management and it also         provides an automatic garbage collector. This collects the unused objects automatically.
Java is a platform-independent language: 
    The programs written in Java language, after compilation, are converted into an intermediate level         language called the bytecode which is apart of the Java platform irrespective of the machine on which     the programs run. This makes java highly portable as its bytecodes can be run on any machine by an        interpreter called the Java Virtual Machine(JVM) and thus java provides ‘reusability of code’. 
Java is an object-oriented programming language: 
    OOP makes the complete program simpler by dividing it into a number of objects. The objects can be     used as a bridge to have data flow from one function to another. We can easily modify data and                function’s as per the requirements of the program. 
Java is a robust language: 
    Java programs must be reliable because they are used in both consumer and mission-critical                     applications, ranging from Blu-ray players to navigation systems. 
Java is a multithreaded language: 
    Java can perform many tasks at once by defining multiple threads. For example, a program that                manages a Graphical User Interface (GUI) while waiting for input  from a network connection uses        another thread to perform and wait’s instead of using the default GUI thread for both tasks. This             keeps the GUI responsive. 
Java programs can create applets: 
    Applets are programs that run in web browsers. 
Java does not require any preprocessor: 
    It does not require inclusion of header files for creating a Java application. Therefore, Java is a very        successful language and it is gaining popularity day by day. 
Important tips 
➢ Understand the basics: 
➢ Patience is the key: 
➢ Practice Coding 
➢ Read about Java regularly 
➢ Study in a group

Comments

Post a Comment

Popular posts from this blog

Get Ethical Hacking Project #1

Thanks for your interest in our course This is a paid course, 150 rs for Indian people, 5$ for international people Instructions to get course: Indian people can get the course by paying using this UPI id   tamilhacks@ybl  (KARTHIKEYAN T) send 150 Rs to this upi id with subject bug bounty and after payment take a screenshot and send that to email id tamilhackstech@gmail.com - you will get the course within 24 hours. (there will be no tax, when paying using upi id)     The above mentioned method is most preferable. if you don't have a upi id app, install  phonepe  or  google pay   app and register there and pay easily  or  pay here using the alternate method to get this course, this link cost 18% gst for the course . (nearly 30-100 Rs for tax and other charges here )   After payment you will receive a payment confirmation mail along with a downlink for the course, you can download the course file using that . the course is in zip format, so after downloading the file extra

Learn c++ in Tamil | Complete guide and tutorial | Beginner to Advance all concepts explained.

hi guys welcome , all the coding used in video are available here : /* hi guys welcome to learn c++ in tamil what is C++ how what software your own program schools,clg,institute.... start 1.interest 2.patience 3.fun 4.practise computer program - app - programming source code - hardware - fb running , executing machine language :  101010 assembly lang : mov h1; high lang : c , c++....java , js , python  eg :  a+b .....1001010  compiler :  human to machine              machine to human  rules :  a+b;  usage:  games, manufacturing , embedded , finance , graphics , etc...  Guide: 1.problem 2.solution - alternative 3.program  - C++ 4.compile  - turboc , ide , codeblocks , cmd 5.result   - library file - linker : #include<iostream.h>    input , output std::cout<<"welcome";   standard character out << " "; primary section : 1.statements   ;  end 2.functions   main() 3.syntax  , syntax error pra

Get Bug Bounty Course

Thanks for your interest in our course Limited Offer This is a paid course, Rs 10000 ,Rs 1000  for Indian people, 75$ 15$ for international people , 50$ 10$ for Srilankan people Instructions to get course: Indian people can get the course by paying using this UPI id  tamilhacks@ybl  send 1000 Rs to this upi id with subject bug bounty and after payment take a screenshot and send that to email id tamilhackstech@gmail.com - you will get the course within 24 hours. (there will be no tax, when paying using upi id)    The above mentioned method is most preferable. if you don't have a upi id app, install phonepe or google pay   app and register there and pay easily  or  pay here using the alternate method to get this course, this link cost 18% gst for the course . (nearly 30-100Rs for tax and other charges here ) After payment you will receive a payment confirmation mail along with a downlink for the course, you can download the course file using that. As for international peopl