TS 68 JavaFX Hints

(Difference between revisions)
(Implement all abstract methods)
(Semantic)
Line 11: Line 11:
      
      
=== {{testcase|Unused variables }} ===
=== {{testcase|Unused variables }} ===
-
*  Copy the code to the editor:
+
*  Copy the code to the editor:  
<code> <pre>         
<code> <pre>         
var a = 10;
var a = 10;
Line 17: Line 17:
var c = a + 30;
var c = a + 30;
</pre> </code>   
</pre> </code>   
-
** {{result|EXPECTED RESULT:  The 'b' variable indicates as unused  }}  
+
* {{result|EXPECTED RESULT:  The 'b' variable is indicated as unused  }}
 +
=== {{testcase|Unused attributes}} ===
 +
*  Copy the code to the editor:
 +
<code> <pre>       
 +
class A{
 +
    public var a;
 +
}</pre> </code> 
 +
* {{result|EXPECTED RESULT:  The 'a' attribute is indicated as unused  }}
== Implement all abstract methods ==
== Implement all abstract methods ==

Revision as of 12:45, 26 February 2010

Author: Alexandr Scherbatiy
Version: 1.2
Last update: 26 February 2010
Introduction:
Comments:


Contents


Semantic

Unused variables

  • Copy the code to the editor:
         
var a = 10;
var b = 20;
var c = a + 30;
  • EXPECTED RESULT: The 'b' variable is indicated as unused

Unused attributes

  • Copy the code to the editor:
         
class A{
    public var a;
}
  • EXPECTED RESULT: The 'a' attribute is indicated as unused

Implement all abstract methods

Argument with Sequence type

  • Copy the code to the editor:
         
abstract class A{
    abstract function f (seq:Boolean[]);
}

class B extends A{

}
  • Implement all abstract methods .
    • EXPECTED RESULT: Implementation of the abstract methods should be added
  
import java.lang.UnsupportedOperationException;

abstract class A{
    abstract function f (seq:Boolean[]);
}

class B extends A{
    override function f (seq : Boolean[]) : Object { 
        throw new UnsupportedOperationException('Not implemented yet');
    }
}


Generic interface

  • Copy the code to the editor:
         
import java.lang.Comparable;

class Vector extends Comparable {
}
  • Implement all abstract methods .
    • EXPECTED RESULT: Implementation of the abstract methods should be added
import java.lang.Comparable;
import java.lang.UnsupportedOperationException;

class Vector extends Comparable {
    override public function compareTo (arg) : Integer {
        throw new UnsupportedOperationException('Not implemented yet');
    }
}
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo