class

Calling a Enum value from another class within the same java project

限于喜欢 提交于 2020-01-06 19:41:52
问题 I have an assignment in my introduction to Java class where we are suppose to read from a file, conduct mathematical operations on it, then output it to another file. i seem to have the file I/O portion down. The problem that I am having is in the mathematical operation stage. We were given a class, called SimpleMath, and are suppose to call methods from it. here is the given class: import java.text.DecimalFormat; public class SimpleMath { // Operation enumeration public enum eOperation {

The declared package test does not match the expected package

烈酒焚心 提交于 2020-01-06 19:41:31
问题 So, I have this code: package test; import test.Pi; public class Demo { public static int pi = 3; public static void main (String args[]) { System.out.println("Hello!"); Pi.main(args); System.out.println("Hello again!"); } } But eclipse keeps throwing up an error at the very first line, saying "The declared package test does not match the expected package". Any help apreciated! Thanks! 回答1: That's not a matter of importing - that means you're trying to declare that the package for this class

passing objects from the global scope to a model

烂漫一生 提交于 2020-01-06 19:28:02
问题 Here's the code of my model in codeigniter. <?php $catalogo = (object) array ( "name" => "catalogo", "url" => "url_catalogo" ); $categorias = (object)array ( "name" => "categorias", "titulo" => "varchar_titulo", ); $novedades = (object)array ( "name" => "novedades", "titulo" => "varchar_titulo", "fecha" => "fecha_publicacion", "descripcion" => "text_descripcion", "categoria" => "fk_categoria" ); $img_nov =(object) array ( "name" => "imagenes_novedades", "url" => "url_img", "novedad" => "fk

AS3: Importing classes/Sharing variables between classes

半城伤御伤魂 提交于 2020-01-06 19:10:56
问题 Ok, this is my problem: i have a variable in a class named Mirror public var line:Sprite = new Sprite(); i want to use that variable in another class named MovieClip. I imported the class in the MovieClip class: public class MovieClips extends MovieClip { import Mirror; public function MovieClips(radius:int, _x:int, _y:int,size:int,span:int,addl:Array) {.... but when i try to do something like this: if (Mirror.line.hitTestObject(ball) == true) { speedY *= -1; } It shows up like an error:

AS3: Importing classes/Sharing variables between classes

三世轮回 提交于 2020-01-06 19:10:28
问题 Ok, this is my problem: i have a variable in a class named Mirror public var line:Sprite = new Sprite(); i want to use that variable in another class named MovieClip. I imported the class in the MovieClip class: public class MovieClips extends MovieClip { import Mirror; public function MovieClips(radius:int, _x:int, _y:int,size:int,span:int,addl:Array) {.... but when i try to do something like this: if (Mirror.line.hitTestObject(ball) == true) { speedY *= -1; } It shows up like an error:

Union of filters in Ruby

杀马特。学长 韩版系。学妹 提交于 2020-01-06 18:11:57
问题 I've designed a class NumberSet which contains an array on which I have to implement certain filters, which I've designed as classes. The code is: class NumberSet include Enumerable def initialize @arr=[] end def each (&block) @arr.each do |member| block.call (member) end end def << number @arr<<number unless @arr.include?(number) end def [] (sito) @arr.select{|number| sito.filter(number)} end end class Filter attr_reader :filter def initialize &block @filter = block end def filter number

<identifier> expected when trying to call a class

[亡魂溺海] 提交于 2020-01-06 16:17:50
问题 I keep on getting the error identifier expected. I am still learning how to call classes and I believe I am doing it wrong. 回答1: You can't just put code inside a class - you need to put it in a method: public class OptionFrame { public void someMethod() { System.out.println ("It works"); } } ... or a constructor: public class OptionFrame { public OptionFrame() { System.out.println ("It works"); } } ... or even a static block: public class OptionFrame { static { System.out.println ("It works")

CODE - The content of an object is changed after executing a function

a 夏天 提交于 2020-01-06 15:58:49
问题 The problem is that the content of $oldpop get magically changed after executing the function func , whereas the input of func is $matepop . Inside func , $oldpop is not used (I added the comment line to show the place - see the end of the code snippet of MAIN.PHP ). Below I provide just some principal parts of the code. Maybe, someone could suggest the reason of the problem? I should mention I don't use static variables. File MAIN.PHP include_once 'func.php'; include_once 'select.php'; class

CODE - The content of an object is changed after executing a function

和自甴很熟 提交于 2020-01-06 15:58:14
问题 The problem is that the content of $oldpop get magically changed after executing the function func , whereas the input of func is $matepop . Inside func , $oldpop is not used (I added the comment line to show the place - see the end of the code snippet of MAIN.PHP ). Below I provide just some principal parts of the code. Maybe, someone could suggest the reason of the problem? I should mention I don't use static variables. File MAIN.PHP include_once 'func.php'; include_once 'select.php'; class

Issue starting activity from non-activity class

夙愿已清 提交于 2020-01-06 15:39:12
问题 I am a noob to android and I have a Map Activity that also uses OverlayItems. Within the onButtonTap method of my overlay class, I want to execute startActivity so i can then use intent.ACTION_CALL. Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("tel:"+MapActivity.phonenumber0)); startActivity(callIntent); in the code above i am asked to create a method for startActivity(Intent), which I don't understand. and when i try... Intent callIntent = new Intent