TS 68 JavaFX Hints

(Difference between revisions)
({{testcase|Unused attributes}})
(Semantic)
Line 29: Line 29:
=== {{testcase|Unused functions}} ===
=== {{testcase|Unused functions}} ===
*  Copy the code to the editor:  
*  Copy the code to the editor:  
 +
<code> <pre> 
class A{
class A{
     public function f(){}
     public function f(){}
Line 34: Line 35:
</pre> </code>   
</pre> </code>   
* {{result|EXPECTED RESULT:  The 'f' function is indicated as unused  }}
* {{result|EXPECTED RESULT:  The 'f' function is indicated as unused  }}
 +
 +
== Dynamic Hints  ==
 +
   
 +
=== {{testcase|Generate variable }} ===
 +
*  Copy the code to the editor:
 +
<code> <pre> 
 +
class A{
 +
  value;
 +
}
 +
</pre> </code> 
 +
* Click on the hint
 +
* Select Create Local Variable
 +
* {{result|EXPECTED RESULT:  The 'var value' code is generated  }}
 +
<code> <pre> 
 +
class A{
 +
  var value;
 +
}
 +
</pre> </code>
== Implement all abstract methods ==
== Implement all abstract methods ==

Revision as of 13:11, 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

Unused functions

  • Copy the code to the editor:
  
class A{
    public function f(){}
}
  • EXPECTED RESULT: The 'f' function is indicated as unused

Dynamic Hints

Generate variable

  • Copy the code to the editor:
  
class A{
  value;
}
  • Click on the hint
  • Select Create Local Variable
  • EXPECTED RESULT: The 'var value' code is generated
  
class A{
  var value;
}

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