Google Wins Java Copyright Case Against Oracle


  • Google has won a six-year court case brought by software firm Oracle, which claimed Google had infringed its copyright by using 11,500 lines of Java code in its Android operating system.
  • A jury has ruled that Google did not unfairly use parts of Java programming language.?Oracle? sought billions in damages from Google.
  • A judge on Thursday ruled Google's use of Java code in the Android operating system does not infringe on Oracle's copyrights and is protected by fair use. Oracle said it would appeal the decision.


Google Wins Java Copyright Case Against Oracle
  • Google wins $9bn Java copyright case with Oracle short by Swarnim Bagre / 05:49 pm on 27 May 2016,Friday
  • A federal jury in San Francisco ruled in favor of Google in the Java copyright case against Oracle on Thursday. Oracle had filed a suit in 2010 against Google claiming that it used code from the Oracle-owned Java programming language in Android without permission, seeking nearly $9 billion in damages. Oracle said that it will appeal against the decision
  • Copyright law expert Professor Pam Samuelson said the litigation was a "very unusual" fair use case, but that the jury ultimately agreed with the fair use defense, including the fact that "Google was the one who made an innovative and highly successful product from Java."
  • The sun has finally set on the Google and Oracle copyright battle. Google has won the long running Java lawsuit against Oracle as the jury found that Android OS does not violate copyrights owned by the latter.
  • Earlier in March Oracle demanded $9.3 billion in damages from Google over the use of Java API in Android which powers about 80% of the world’s mobile devices.. The company stated that Google needed a license to use its Java programming language to develop Android however, the jury rejected that argument and concluded Google made fair use of the code under copyright law. Oracle owns the programming language Java as it was acquired Sun Microsystems in 2010.
  •  "Today's verdict that Android makes fair use of Java APIs represents a win for the Android ecosystem, for the Java programming community, and for software developers who rely on open and free programming languages to build innovative consumer products," Google said in an emailed statement. 
  • The verdict is the latest development in the six-year legal skirmish over software copyrights with billions of dollars in damages at stake. 
  •  Oracle pledged it would appeal the verdict. "We strongly believe that Google developed Android by illegally copying core Java technology to rush into the mobile device market. Oracle brought this lawsuit to put a stop to Google’s illegal behavior. We believe there are numerous grounds for appeal," Oracle's general counsel Dorian Daley said in an emailed statement.
     

linux unix commands with examples

Unix/Linux Commands
Ls: List of all files
    Syntax
                             Function
Ls-l
Complete properties of files or folders
Ls-lt
List of files or folders order by time
Ls-ltr
List of files or folders reverse order by time
Ls-d
Displays only directories

Cd: Change directory
    Syntax
                             Function
cd-
Change directory to previous working directory
cd..
Change working directory to parent directory
Cd~
Same as above
cd../..
Change two levels up in the directory structure
Command
          Syntax
                     Function
Cp(copy)
Cp source..destination
Copy the files and directories
sort
Sort[option][filename]
Sort the contents of text line by line
uniq
Uniq[option] filename
Eliminates duplicate lines from file
cat
Cat[options][files]
Display the contents of the file
join
Join[option]file1 file2
Join he two files based on key field present
sed
Sed..[script][input file]
Basic text transformations on input
head
head[option][files]
Prints first N lines from file
tail
Tail[option][file]
Print last N lines from file
alias
Alias[name=[’command]’]
Alternative name used for long strings
date
Date[option]…[format]
Print the date or change the system date and time
zip
Zip[option]zipfile file_list
Compress the file and reduce file size
grep
Grep[option]pattern[list of files]
Search the words in a file
find
Find[pathnames][condition]
Search for directories, files and links
cut
Cut[option]…[file]
Select sections of text from each line in a file
chmod
Chmod[option]mode… filename
Change or assign the permissions of files or directories
rmdir
Rmdir[options]directories
Remove directories
rm
Rm[options]directories/files
Remove both files and directories
mkdir
Mkdir[option]directories
Creates single or multiple directories
mv(move)
Mv[option]source.. destin
Move or rename the files and directories
hostname
Hostname[option][file]
Name of the system or server you are logged into.
paste
Paste[options]file-list
Merges the lines from multiple files
split
Split..filename
Split the one file in to many pieces
mail
Mail[options]to address [sending mail options]
Send email to users, also read delete mails
kill
Kill[-s signal] pid
Terminate or kill the process, also running the process
top
Top[options]
Provides system information
expr
Expr[expression]
For doing arithmetic operations
WC
Wc[options]filename
Finding number of lines, characters, words in a file
tr (Translate)
Tr[options]set1 [set2]
Translate, delete, squeezed characters

How to get table cell data using JavaScript

How to get table row data in javascript:

  • When we are working with HTML tables we will get a scenario like to get whole table rows data, or table td values , table cell value in JavaScript.
  • For that we need to read the table by using JavaScript.
  • lets see example on get table cell data using java script.
  • Before that lets see how to read the data of table using JavaScript
  • To find number of rows of a table by using table id in JavaScript.



  1. var numberOfrows=document.getElementById("tableData").rows.length;

  • Get number of cells or number of tds inside each tr (table row)

  1. var numberoftds = document.getElementById("tableData").rows[0].cells.length;


  • JavaScript get table row values get table td data

  1. var numberoftds = document.getElementById("tableData").rows[0].cells.item(0).innerHTML;


Example on get table each row data using javascript:



  1. <script type="text/javascript">
  2. function checkFun() {

  3. var n1 = document.getElementById("tableData").rows.length;

  4. var i=0,j=0;
  5. var str="";
  6.  
  7. for(i=0; i<n1;i++){
  8.  
  9. var n2 = document.getElementById("tableData").rows[i].cells.length;
  10.  
  11. for(j=0; j<n2;j++){
  12.  
  13. var x=document.getElementById("tableData").rows[i].cells.item(j).innerHTML;\
  14.  
  15.     str=str+x+":";
  16.  
  17. }
  18. str=str+"#";
  19.    
  20. }
  21.    document.getElementById("tablecontent").innerHTML=str;

  22.    
  23. }
  24. </script>




  1. <body onload="checkFun()">
  2.  
  3. <table id="tableData" border="1">
  4.     <tr>
  5.         <td >37</td>
  6.         <td >46</td>
  7.         <td >3</td>
  8.         <td >64</td>
  9.     </tr>
  10.     <tr>
  11.         <td >10</td>
  12.         <td >4</td>
  13.         <td >7</td>
  14.         <td >21</td>
  15.     </tr>
  16.     
  17. </table>
  18. <p id="tablecontent" ></p>
  19.  </body>


get table cell row td data value javascript

  • Here in this example on page loading we called the JavaScript function
  • For that used body onload="func()" .
  • Practice this example in your System.

Control statements in java with examples

  • Programs in java will be executed in sequential manner means line by line execution of statements.
  • By using control statements we can control the flow of execution.
  • We have three types of control statements in java.
  1. Decision making Statements.
  2. Iteration statements.
  3. Branching statements. 




1.Decision making statements in java: 

  • In some cases we will have a situation like need to execution set of statements based on a condition
  • In this scenario we need to use decision making statements in java.
  1. if
  2. if-else
  3. if-else-if
  4. switch

Simple if

  • Based on some condition if we want to execute some set of statements then we need to use if condition in java.
  • We need to keep all the required statements inside if block .
  • If the condition is true then control executes the whole block otherwise it skips the if block of statements.

  1. if( condition ){
  2. // code
  3. }

Java example program on if control statement:

  1. package controlstatementsinjava;
  2. import java.util.Scanner;
  3.  
  4. public class ControlStatementsInjava {
  5.  
  6.     /**
  7.      * @website: www.instanceofjava.com
  8.      */
  9. public static void main(String[] args) {
  10.         
  11.   Scanner in= new Scanner(System.in);
  12.  
  13.   System.out.println("Please enter a number");
  14.   int n=in.nextInt();
  15.         
  16. if(n%2==0){
  17.    System.out.println(n+" is even number");
  18.         
  19.  }
  20.   
  21. if(n%2!=0){
  22.      System.out.println(n+" is odd number");
  23. }
  24.  
  25. }
  26. }

Output:

  1. Please enter a number
  2. 5
  3. 5 is odd number

If else condition:

  • If the condition is true then control executes the whole block otherwise it skips the if block of statements
  • if condition is false  if we need to execute another set of statement we can write another if and keep all the statements in that block.
  • instead of checking multiple times we can simply use else block .
  • More about in else statement in java

  1. if( condition ){
  2. // code
  3. }else{
  4. //code
  5. }

 if else control statement with example programs:

  1. package controlstatementsinjava;
  2. import java.util.Scanner;
  3.  
  4. public class ControlStatementsInjava {
  5.  
  6.     /**
  7.      * @website: www.instanceofjava.com
  8.      */
  9. public static void main(String[] args) {
  10.         
  11.   Scanner in= new Scanner(System.in);
  12.  
  13.   System.out.println("Please enter a number");
  14.   int n=in.nextInt();
  15.         
  16. if(n%2==0){
  17.    System.out.println(n+" is even number");
  18.         
  19.  }else{
  20.      System.out.println(n+" is odd number");
  21. }

  22.  
  23. }
  24. }

Output:

  1. Please enter a number
  2. 5
  3. 5 is odd number


if else ladder :

  • In some cases we may get requirement with multiple conditions in such cases we need to use if else ladder.(if -else-if-else if -else...)

  1. if( condition ){
  2. // code
  3. }else if{
  4. //code
  5. }else {
  6.  //code
  7. }

 if else if control statement with example programs:


  1. package controlstatementsinjava;
  2. import java.util.Scanner;
  3.  
  4. public class ControlStatementsInjava {
  5.  
  6.     /**
  7.      * @website: www.instanceofjava.com
  8.      */
  9. public static void main(String[] args) {
  10.         
  11.   Scanner in= new Scanner(System.in);
  12.  
  13.   System.out.println("Please enter your age");
  14.   int age=in.nextInt();
  15.         
  16. if(age<=18){
  17.    System.out.println("Your age is between 1-18");
  18.         
  19.  }else if ((age>=18) && (age<=35)){
  20.      System.out.println(" Your age is between 18-35");
  21. }
  22. else if ((age>=35) && (age<=50)){
  23.      System.out.println(" Your age is between 35-50");
  24. }else{
  25.  
  26.   System.out.println(" Your age is above 50");
  27.  
  28. }
  29.  
  30. }
  31. }

Output:

  1. Please enter your age
  2. 20
  3. Your age is between 18-35

control statements in java

Switch statement in java:

  • Instead if writing number of if conditions we can use single switch statement


  1. switch(value)
  2.  case n1: statements;
  3. break;
  4. case n2 : statements;
  5. break;
  6. default: statements;
  7. }

Java example program on switch statement in java:


switch statement in java

Bitwise operators in java with example

  • Bitwise operators in java performs operation on bits 
  • Bitwise operators performs bit by bit operations
  • Bit-wise operators operates on individual bits of operands.



 Bit wise Operators in Java:

  1. ~      : Bit wise unary not
  2. &     : Bit wise And
  3. |       : Bit wise OR
  4. ^      : Bit wise Exclusive OR


 1.Bit wise Unary Not  ~:

  • Bit wise Unary not Inverts the bits.
  • Lets see a java program on bit wise unary not

Java Example program on bit wise unary not operator ~:

  1. package operatorsinjava;
  2. public class BitwiseUnaryNotDemo {
  3.  
  4.     /**
  5.      * @www.instanceofjava.com
  6.      */
  7.     public static void main(String[] args) {
  8.  
  9.   int x=2;
  10.  
  11.   System.out.println(~x);
  12.         
  13.   int y= 3;
  14.  
  15.   System.out.println(~y);
  16.         
  17.   int z= 4;
  18.         
  19.   System.out.println(~z);
  20.  
  21.     }
  22.  
  23. }

Output:


  1. -3
  2. -4
  3. -5

bitwise unary operator in java


2. Bitwise AND operator:

  • Bit wise And returns 1 if both operands position values are 1 otherwise 0.
  • Bitwise operation on two numbers
  • 1 & 2
  • 001
    010
    -----
    000 =0
    -----
  • 2 & 3
  • 010
    011
    -----
    010 =2
    -----
Java Example program on bitwise AND operator &:


  1. package operatorsinjava;
  2. public class BitwiseAndDemo {
  3.  
  4.     /**
  5.      * @www.instanceofjava.com
  6.      */
  7. public static void main(String[] args) {

  8.    int x=1;
  9.    int y=2;
  10.         
  11.   System.out.println(x&y);
  12.         
  13.   int i=2;
  14.   int j=3;
  15.         
  16.  System.out.println(i&j);
  17.         
  18.  System.out.println(4&5);
  19.  
  20. }
  21.  
  22. }

Output:


  1. 0
  2. 2
  3. 4
Bitwise And operator in java Example


3.Bitwise OR operator in Java | :

  • Bit wise OR returns 1 if  any one operands position values are 1 or both 1 s. otherwise 0.
  • 1 |2
  • 001
    010
    -----
    011 =3
    -----
  • 2 | 3
  • 010
    011
    -----
    011 =3
    -----
Java Example program on bitwise OR operator |:

  1. package operatorsinjava;
  2. public class BitwiseORDemo {
  3.  
  4.     /**
  5.      * @www.instanceofjava.com
  6.      */
  7. public static void main(String[] args) {

  8.    int x=1;
  9.    int y=2;
  10.         
  11.   System.out.println(x|y);
  12.         
  13.   int i=2;
  14.   int j=3;
  15.         
  16.  System.out.println(i|j);
  17.         
  18.  System.out.println(4|5);
  19.  
  20. }
  21.  
  22. }

Output:

  1. 3
  2. 3
  3. 5

4.Bit wise Exclusive OR operator in java ^:

  • Bit wise XOR operator returns 1 if any of the operands bits position 1 
  • Java XOR operator returns 0 if both operands position is 1.
  • Lest see java Xor on 1 ^ 2
  • 1 ^ 2
  • 001
    010
    -----
    011 =3
    -----
  • Lest see java xor operation on 2 ^3
  • 2 ^ 3
  • 010
    011
    -----
    001 =1
    -----

Java Example program on bitwise OR operator |:

  1. package operatorsinjava;
  2. public class BitwiseXORDemo {
  3.  
  4.     /**
  5.      * @www.instanceofjava.com
  6.      */
  7. public static void main(String[] args) {

  8.    int x=1;
  9.    int y=2;
  10.         
  11.   System.out.println(x^y);
  12.         
  13.   int i=2;
  14.   int j=3;
  15.         
  16.  System.out.println(i^j);
  17.         
  18.  System.out.println(4^5);
  19.  
  20. }
  21.  
  22. }

Output:

  1. 3
  2. 1
  3. 1


Java XOR bitwise operator

Ternary operator in java

  • Ternary operator also known as conditional operator in java.
  • Ternary operator used to evaluate boolean expression and it consists of three operands.
In Java, the ternary operator is a shorthand way to write an if-else statement. The operator has the following general form:
    (condition) ? expression1 : expression2
      The condition is a Boolean expression that is evaluated to either true or false. If the condition is true, the operator returns the value of expression1, and if the condition is false, it returns the value of expression2.

      Here's an example of how you might use the ternary operator in a Java program:

      int x = 5;
      int y = 10;

      int min = (x < y) ? x : y;
      System.out.println(min);  // Output: 5

      In the above example, the ternary operator compares the values of x and y, and assigns the value of x to the variable min if x is less than y, and assigns the value of y to min otherwise. This can be interpreted as (x<y) ? min=x : min=y .

      It's also possible to use ternary operator for more complex use cases like below:

      String result = condition ? "value if true" : anotherVar == null ? "null value" : anotherVar;

      It's worth noting that, although ternary operator is a shorthand way to write an if-else statement, it can make code harder to read when the expressions are too long or the conditions are too complex. In such cases, it's often better to use an if-else statement instead.





      Ternary operator in java syntax:

      1. variable x = (expression) ? value if true : value if false

      • Value of x will be decided based on the condition. if condition is true then it assigns first value to the variable
      • If Expression is false then it assigns second value to the variable.

      Java simple example program on ternary operator / conditional operator in java


      1. package operatorsinjava;
      2. public class TernaryOperator {
      3.  
      4.     /**
      5.      * @ www.instanceofjava.com
      6.      * 
      7.      */
      8.  public static void main(String[] args) {
      9.         
      10.  // checking condition 2>3 and if true assign 3 else 3
      11.   int x= (2>3)?3:2;
      12.         
      13.   System.out.println(x);
      14.         
      15.  // checking condition 5<4 if true assign 4 else 3
      16.  int y= (5<4)?4:3;
      17.         
      18.  System.out.println(y);
      19.  
      20. }
      21.  
      22. }
      Output:

      1. 2
      2. 3

      Ternary operator in java for boolean:

      Java simple example program on ternary operator / conditional operator for boolean

      1. package operatorsinjava;
      2. public class TernaryOperator {
      3.  
      4.     /**
      5.      * @ www.instanceofjava.com
      6.      * 
      7.      */
      8.  public static void main(String[] args) {
      9.         
      10.  
      11.  boolean x= true ? true: false;
      12.         
      13.  System.out.println(x);
      14.         
      15.  boolean y= false ? true : false;
      16.             
      17.  System.out.println(y);
      18.         
      19.  boolean z= false ? false : true;
      20.         
      21.  System.out.println(z);
      22.  
      23. }
      24.  
      25. }
      Output:

      1. true
      2. false
      3. true

      Ternary operator in java for Strings:

      Java simple example program on ternary operator / conditional operator for String

      1. package operatorsinjava;
      2. public class TernaryOperatorForStrings{
      3.  
      4.     /**
      5.      * @ www.instanceofjava.com
      6.      * 
      7.      */
      8. public static void main(String[] args) {
      9.         
      10.  String str= "java".equals("java") ? "Java Questions" : "Java Programs";
      11.         
      12.  System.out.println(str);
      13.         
      14.  String str1= (1==3)? "its true" : "its false";
      15.         
      16.  System.out.println(str1);
      17.        
      18. }
      19.  
      20. }
      Output:

      1. Java Questions
      2. its false

      Ternary operator in java for null;

      Java simple example program on ternary operator / conditional operator for null check

      1. package operatorsinjava;
      2. public class TernaryOperatorForStrings{
      3.  
      4.     /**
      5.      * @ www.instanceofjava.com
      6.      * 
      7.      */
      8. public static void main(String[] args) {
      9.         
      10. String str= null;
      11.  
      12. String str1= (str==null) ? "its true" : "its false";
      13.  
      14. System.out.println(str1);
      15.         
      16. String str2= (str1!=null) ? "its true" : "its false";
      17.  
      18. System.out.println(str2);

      19. }
      20.  
      21. }
      Output:

      1. its true
      2. its true

      ternary operator in java


      Select Menu