首页 \ 问答 \ 变量名称声明声明要存储的值的类型?(A declaration of a variable name declares the type of value to be stored? A trick?)

变量名称声明声明要存储的值的类型?(A declaration of a variable name declares the type of value to be stored? A trick?)

所以,我在我的计算机科学类(我们使用Java)中有这个真/假的问题:

变量名称的声明声明了要存储在那里的值的类型

(“类型”这个词在问题上是大胆的)

现在,我知道当你声明一个变量时,你必须在Java中指定这个类型,因为它是静态类型的:

int x;

在该代码中,声明了名称为x的变量,并且我们知道它是int类型的。

但是这个问题提到了术语“变量名称”。 从技术上讲,变量的名称/标识符不负责声明变量的类型。 如果程序员选择的话,这个名字甚至不需要提及变量的类型。

我想知道什么是正确的选择。 这是真的还是假的? 对我来说,似乎很模糊......我该怎么办?


So, I have this true/false question in my computer science class (we're using Java):

A declaration of a variable name declares the type of value to be stored there.

(the word "type" was bold in the question)

Now, I know that when you declare a variable you must specify the type in Java because it is statically typed:

int x;

In that code, a variable with the name of x is declared, and we know it is of type int.

However the question mentioned the term "variable name". Technically, the name/identifier of the variable is not responsible for declaring the variable's type. The name doesn't even need to allude to the variable's type if the programmer chooses.

I was wondering what the right choice would be here. Would it be true or false? To me it seems rather ambiguous... what should I do?


原文:https://stackoverflow.com/questions/8979643
更新时间:2022-07-17 17:07

最满意答案

见NDK样品。 这里有一个:\ android-ndk \ samples \ native-activity

在线链接: http//developer.android.com/reference/android/app/NativeActivity.html


See the NDK Samples. There is one here: \android-ndk\samples\native-activity

On-line link: http://developer.android.com/reference/android/app/NativeActivity.html

相关问答

更多
  • 裁剪 - 更改加载纹理时加载的纹理坐标; 例如,如果您想要将图像载荷的顶部和底部10%从(0.0,0.1)裁剪为(1.0,0.9)。 缩放 - 答案取决于缩小到640 * 640的大小。 OpenGL过滤不是为直接处理大的缩减比例而设计的 - 它不是图像处理库 - 但假设相对较小的缩放比率,则确保您已启用GL_LINEAR纹理过滤而不是GL_NEAREST。 如果你有一个很大的缩减比例,你可能需要首先对纹理进行mipmap,然后将GL_LINEAR_MIPMAP_NEAREST或GL_LINEAR_MIPM ...
  • 您需要禁用GL_DEPTH_TEST否则如果您绘制的东西的深度/深度与已存在的深度相同,则不会显示。 因此,在您的情况下,添加gl.glDisable(GL10.GL_DEPTH_TEST) ,您可以在其中启用混合(并在不混合时再次启用它)。 您可能还想清除绘图开头的深度缓冲区: gl.glClear(GL10.GL_COLOR_BUFFER_BIT|GL10.GL_DEPTH_BUFFER_BIT) Ok! Finally figured it out Turns out I had to move th ...
  • 对的,这是可能的。 使用渲染到纹理(RTT) 我们可以将一个FBO作为一个纹理,所以你应该创建两个FBO。 下面是一个RTT的例子 glGenFramebuffers(1, &fbo[object_id]); glBindFramebuffer(GL_FRAMEBUFFER, fbo[object_id]); glGenRenderbuffers(1, &rboColor[object_id]); glBindRenderbuffer(GL_RENDERBUFFER, rboColor[object_id ...
  • 这不是一个正确的生命周期,但它已经接近了。 每当GL表面变得完全模糊时,其EGL上下文将被破坏,并且当发生这种情况时,将释放通过OpenGL调用分配的任何资源。 因此,除非您的应用程序在运行时需要主动管理(例如,在内存中缓存太多纹理等),否则无需手动释放这些资源。 请注意,这仅适用于OpenGL通过OpenGL调用分配的资源和内存。 您像往常一样需要释放在OpenGL之外分配的任何缓冲区。 That's not quite the right lifecycle, but it's close. Any t ...
  • 这取决于你的小部件是什么意思。 如果你在谈论app小部件(或Launcher小部件),你就无法做你想做的事。 如果要在应用程序中创建窗口小部件,请使用SurfaceView(API演示有几个示例。) It depends what you mean by widget. If you are talking about app widgets (or Launcher widgets), you cannot do what you want. If you are creating a widget in ...
  • 我自己找到了解决问题的方法。 如前所述,这是包含目录设置中的一个问题。 我通过在gradle文件中指定起源C ++标志的包含目录来编译应用程序-I在这里你可以找到完整的gradle文件: apply plugin: 'com.android.model.application' model { android { compileSdkVersion 24 buildToolsVersion "23.0.3" defaultConfig { ...
  • 见NDK样品。 这里有一个:\ android-ndk \ samples \ native-activity 在线链接: http : //developer.android.com/reference/android/app/NativeActivity.html See the NDK Samples. There is one here: \android-ndk\samples\native-activity On-line link: http://developer.android.com/r ...
  • 首先,Canvas不能做一个游戏。 然而,如果你看看我完全用画布“Squirrel Wars”(在市场上)完成的游戏,那是关于在平均设备上使用画布的游戏的局限性。 使用Canvas的问题是您必须使用的内存限制,以及FPS的局限性,因为它不是硬件加速的。 切换到OpenGL ES 1.1的最大限制和原因之一是,如果需要,OpenGL可以更轻松地移植到iOS。 同样使用OpenGL ES,你将拥有更多的权力,你可以控制更多的东西,而且它应该足以容纳许多精灵,因为你可以在屏幕上摆弄混乱。 在我现在设计的Open ...
  • 我认为这根本不是一个真正的解决方案。 我在这里遇到了同样的问题,在本机代码中使用了framebuffer对象,并且通过这样做 framebuffer = (GLuint) 0; 你只使用默认的帧缓冲区,它始终存在并保留为0.从技术上讲,你可以删除所有与帧缓冲区相关的代码,你的应用程序应该正常工作,因为始终生成帧缓冲区0并且是由defaut绑定的。 但是,您应该能够生成多个帧缓冲区并使用绑定函数(glBindFramebuffer)在它们之间进行交换。 但这似乎并不适合我,我还没有找到真正的解决方案。 关于 ...
  • 我遇到了同样的问题。 您只需将帧大小乘以屏幕比例,如我在本答案中所述。 I've run into the same problem. You just have to multiply the frame size with the screen scale as I have stated in this answer.

相关文章

更多

最新问答

更多
  • h2元素推动其他h2和div。(h2 element pushing other h2 and div down. two divs, two headers, and they're wrapped within a parent div)
  • 创建一个功能(Create a function)
  • 我投了份简历,是电脑编程方面的学徒,面试时说要培训三个月,前面
  • PDO语句不显示获取的结果(PDOstatement not displaying fetched results)
  • Qt冻结循环的原因?(Qt freezing cause of the loop?)
  • TableView重复youtube-api结果(TableView Repeating youtube-api result)
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • SQL Server 2014版本支持的最大数据库数(Maximum number of databases supported by SQL Server 2014 editions)
  • 我如何获得DynamicJasper 3.1.2(或更高版本)的Maven仓库?(How do I get the maven repository for DynamicJasper 3.1.2 (or higher)?)
  • 以编程方式创建UITableView(Creating a UITableView Programmatically)
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何防止调用冗余函数的postgres视图(how to prevent postgres views calling redundant functions)
  • Sql Server在欧洲获取当前日期时间(Sql Server get current date time in Europe)
  • 设置kotlin扩展名(Setting a kotlin extension)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 如何在vim中启用python3?(How to enable python3 in vim?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • dedecms如何安装?
  • 在哪儿学计算机最好?
  • 学php哪个的书 最好,本人菜鸟
  • 触摸时不要突出显示表格视图行(Do not highlight table view row when touched)
  • 如何覆盖错误堆栈getter(How to override Error stack getter)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • USSD INTERFACE - > java web应用程序通信(USSD INTERFACE -> java web app communication)
  • 电脑高中毕业学习去哪里培训
  • 正则表达式验证SMTP响应(Regex to validate SMTP Responses)