Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Compile and Execute Java Online

public class HelloWorld{

    public class Pessoa 
    {
        private String nome;
        private String endereco;
        
        public String getNome (){
            return nome;
        }
        
        public void setNome (String nome)
        {
            this.nome = nome;    
        }
        
    }
    
    public class Fisica extends Pessoa
    {
    
    }
    
    public class Juridica extends Pessoa
    {
    
    }
    
    public static void main(String []args)
    {
        HelloWorld obj = new HelloWorld;
        // Fisica objetoPessoaF = new Fisica;
        // Juridica objetoPessoaJ = new Juridica;
        // System.out.println(objetoPessoaF.getNome());
    }
    
}

aaaaa

public class HelloWorld{

     public static void main(String []args){
        Thread t1=new Thread();
        Thread t2=new Thread();
        Thread t3=t1;
        System.out.println(t1==t3);
        System.out.println();
     }
}

profile3

public class HelloWorld{

     public static void main(String []args){
        System.out.println("Hello World");
     }
}

Test

public class HelloWorld{

     public static void main(String []args){
        System.out.println("Hello World");
     }
}

Compile and Execute Java Online

//reverse a string
import java.util.Scanner;
public class Hello
{
    public static void main(String args[])
    {
    String a;
    a=new String();
    Scanner in=new Scanner(System.in);
    System.out.println("Enter the string you want to reverse : ");
    a=in.nextLine();
    System.out.println("The entered string is : "+a);
    char temp;
    char y[]=a.toCharArray();
    for(int i=0;i<y.length/2;i++)
    {
        temp=y[i];
        y[i]=y[y.length-i-1];
        y[y.length-i-1]=temp;
    }
    for(int i=0;i<y.length;i++)
    System.out.print(y[i]);
    }
}

Compile and Execute Java Online

public class HelloWorld{

     public static void main(String []args){
        System.out.println("Hello World");
     }
}

Compile and Execute Java Online

public class counter{

     public static void main(String []args){
        
        int counter = 2;
        while (counter<=100) {
        System.out.println("["+ counter + "] ");
        counter+=2;
        }
     }
}

HelloWorld

public class HelloWorld{

     public static void main(String []args){
        System.out.println("Hello World");
     }
}

gggg

import java.util.*;

public class HelloWorld{

     public static void main(String []args){
        System.out.println("Hello World");
         List<String> userNames = new ArrayList<>();
        userNames.add("Bhanu");
   	    userNames.add("Teja");
   	    userNames.add("Chandra");
   	    //userNames.add(new Integer(5));
   	    modify(userNames);
   	    System.out.println(userNames);
     }
     
     public static void modify(List names){
         names.add("Hello");
         names.add(new Integer(5));
         names.add(5);
         }
     
     
}

Saddle Points

public class saddlePoint
{
    public static void main(String[] args)
    {
       int a[][] = new int [3][3];
       a[0][0] = 1;
       a[0][1] = 2;
       a[0][2] = 3;
       a[1][0] = 2;
       a[1][1] = 3;
       a[1][2] = 4;
       a[2][0] = 3;
       a[2][1] = 4;
       a[2][2] = 5;
       
       for(int i = 0; i < a.length; i++)
       {
           int highestColIndex;
           highestColIndex = columnIndexWithMaxRowValue(a); 
           boolean isLowest = isMaxRowTheMinColumn(a,highestColIndex); 
           
           if (isLowest == true) 
           {
               System.out.println("Saddle point is at row " + i + " and column " + highestColIndex);
           }
           else
           {
               System.out.println("No Saddle point in row " + i);
           }
       }           
    }
    
    public static int columnIndexWithMaxRowValue(int [][] a)
    {
        int columnIndex = 0;
        int i = 0;
        int maxRow = a[i][0];  
           
           for(int j = 0; j < a.length; j++)
           {
               if(a[i][j] > maxRow)
               {
                   maxRow = a[i][j];
                   columnIndex = j;
               }
            }
        
        return columnIndex;    
    }
  
    
    public static boolean isMaxRowTheMinColumn(int [][] a, int columnIndex)
    {
        int minColumn = a[0][columnIndex];
        
        for(int k = 0; k < a.length; k++)
        {
            if(a[k][columnIndex] < minColumn)
            {
                minColumn = a[k][columnIndex];
                return false;
                
            }
        }
        
        return true;
    }
  
}

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.